 /*
 * GREXGUI.java
 *
 * Created on den 11 maj 2007, 09:09
 */

package grex.Graphics;


import grex.WekaModels.GrexM5P;
import grex.Data.ArffTableModel;
import grex.ErrorManagement.ErrorHandler;
import grex.ErrorManagement.ErrorManager;
import grex.ErrorManagement.EvolutionListener;
import grex.EvolutionProcess;
import grex.IPredictiveModel;
import grex.Options;
import grex.fitnessfunctions.ErrorFunctions.ErrorCalculator;
import grex.fitnessfunctions.FitnessFunction;
import grex.Nodes.GeneException;
import grex.WekaModels.GrexJ48Bag;
import grex.WekaModels.GrexM5PBag;
import grex.WekaModels.WekaPredictiveModel;

import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.beans.PropertyVetoException;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

/**
 *
 * @author  rik
 */
public class GREXGUI extends javax.swing.JFrame implements ErrorHandler{
    private FileDialog jfcData;
    private FileDialog jfcBNF;
    boolean cats=false,cons=false,taskType=false;    
    private EvolutionProcess evolutionaryProces;
    private int errorCount=0;
//    TreePanel tp = new TreePanel(null,"");
    private ArffTableModel currentData;
    private ExperimenterTab expermienter = new ExperimenterTab(this);
    private DataFrame dataFrame;
    private int nrOfFolds=10;
    private DefaultComboBoxModel fileModel;
    private String PLEASE_SELECT_FILE = "Please select a file";
        String[] bnfs;
    /** Creates new form GREXGUI */
    public GREXGUI() {    
            this.setIconImage(new javax.swing.ImageIcon(getClass().getResource("/grex/Graphics/pics/G16.gif")).getImage());           
                            
            setLookAndFeel();
             
            initComponents();            
          initDesktopPane();
          //  pack();
            tabOptions.addChangeListener(new MyChangeListener());
            this.validate();
            ErrorManager.getInstance().addErrorhandler(this);
            initGuiState();
            try{
                currentData = new ArffTableModel(selectedFile);
            }catch(Exception e){
                currentData = new ArffTableModel("iris.arff");
            }
            loadDiredctoryARFFs();
            loadDiredctoryBNFs();
            initBnfCmbx();
            jcmbBNF.setSelectedItem(selectedBNF);
            initFitnessCmbx();

//            currentData = new ArffTableModel(jcmbDataFile.getSelectedItem().toString());
            
            
          //  
          

          jpnlExperimenter.add(expermienter,BorderLayout.CENTER);          
          //pack();

          this.setExtendedState(JFrame.MAXIMIZED_BOTH);             
          
      //    tabOptions.remove(jpnlTabTest);
       //   tabOptions.remove(jpnlTabError);

          
    }
    

    
    public void showPDF(String file){
                             
	       try {

            File pdfFile = new File("Publications\\"  + file);

            if (pdfFile.exists()) {

                if (Desktop.isDesktopSupported()) {
                    Desktop.getDesktop().open(pdfFile);
                } else {
                    System.out.println("Awt Desktop is not supported!");
                }

            } else {
                System.out.println("File does not exists: " + "Publications" + File.pathSeparator + file);
            }

            System.out.println("Done");

        } catch (Exception ex) {
            ex.printStackTrace();
        }

    }

    private void SimplificationStateChanged() {
        jftfSimpBatchSize.setEnabled(jchbSimplify.isSelected());
        jftfSimpGenerations.setEnabled(jchbSimplify.isSelected());
        jftfSimpPopulation.setEnabled(jchbSimplify.isSelected());
        jlblSimpBatch.setEnabled(jchbSimplify.isSelected());
        jlblSimpPopulation.setEnabled(jchbSimplify.isSelected());
        jlbSimpGenerations.setEnabled(jchbSimplify.isSelected());
    }

    
    
    private void loadFile(){ //Called automatically when a new item is selected. (First time in InitGUI)
        String item = jcmbDataFile.getSelectedItem().toString();
        if(item.equalsIgnoreCase(PLEASE_SELECT_FILE))
            return;
        boolean prevProblemTyp=true;
        if(currentData!=null)
            prevProblemTyp = currentData.isClassificationTask();
        try{
        currentData = new ArffTableModel(jcmbDataFile.getSelectedItem().toString(),nrOfFolds,1);
        }catch(Exception e){
            currentData = new ArffTableModel("iris.arff",nrOfFolds,1);
            jcmbDataFile.setSelectedItem("iris.arff");
        }
        dataFrame = new DataFrame(currentData,nrOfFolds,this);
        
        if(currentData == null || prevProblemTyp!=currentData.isClassificationTask()){
            loadDiredctoryBNFs();
            initBnfCmbx();
        }

        initFitnessCmbx();
        initComboBoxes();
        if(((String)jcmbBNF.getSelectedItem()).startsWith("Fuzzy"))
            currentData.fuzzit(3);
    }
    
    public void updateGUI(){
        this.currentData = dataFrame.getModel();
        nrOfFolds = currentData.getNrOfFolds();

        //  this.currentData.setNrOfFolds(dataFrame.getNrOfFolds());
        initComboBoxes();
    }
    public void addInternalFrame(JInternalFrame iFrame){
        jdtpMain.add(iFrame);
        //jdtpMain.add(ef, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jdtpMain.getDesktopManager().maximizeFrame(iFrame);

      //  jdtpMain.getDesktopManager().resizeFrame(ef, 0, 0, jdtpMain.getWidth(), jdtpMain.getHeight());
      // jdtpMain.add(ef,javax.swing.JLayeredPane.DEFAULT_LAYER);

      // jdtpMain.getDesktopManager().resizeFrame(ef,0,0, jdtpMain.getWidth(), jdtpMain.getHeight()/2);
       /* try {
            ef.setMaximum(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(GREXGUI.class.getName()).log(Level.SEVERE, null, ex);
        }*/
       //ef.toFront();
        
    }
    
    public void setEnabled(boolean enabled){
        for(Component c:getComponents())
            sEnabled(c,enabled);
        jcmbFold.setEnabled(enabled);
        jcmbValFold.setEnabled(enabled);
        
    }
    
    private void sEnabled(Component c, boolean enabled){
        if(c==jdtpMain)
            return;
        if((c instanceof Container) && !(c instanceof JComboBox)){
            Container ct =(Container) c;
            for(Component c2:ct.getComponents())
                sEnabled(c2,enabled);
        }
        c.setEnabled(enabled);
    }
    

    String selectedFile="",selectedBNF="";
    private void initGuiState(){
        ObjectInputStream oi = null;        
        try {           
            oi = new ObjectInputStream(new FileInputStream("GuiState.dat"));             
            Object object = oi.readObject();
            if(object instanceof Options){
                Options state = (Options) object;
                jftfBatchSize.setValue(state.getBATCH_SIZE());
                jftfCreationDepth.setValue(state.getMAX_CREATION_DEPTH());
                jftfGenerations.setValue(state.getGENERATIONS());
                jftfLengthPunishment.setValue(state.getPUNISHMENT_FOR_LENGTH());
                jftfMutation.setValue(state.getMUTATION_PROBABILITY());
                jftfPersistence.setValue(state.getSTOP_WITHOUT_IMPROVMENT());
                jftfPopulation.setValue(state.getPOPULATION_SIZE());
                jftfSimpBatchSize.setValue(state.getSIMPLIFICATION_BATCH());
                jftfSimpGenerations.setValue(state.getSIMPLIFICATION_GENERATIONS());
                jftfSimpPopulation.setValue(state.getSIMPLIFICATION_POPULATION());
                jftfTrainImportance.setValue(state.getTRAIN_IMPORTENS());
                jftfValImportance.setValue(state.getVAL_IMPORTENS());
                
                jcmbDataFile.getModel().setSelectedItem(PLEASE_SELECT_FILE);
                selectedFile = state.getDATA_FILE();

                    
                //initBnfCmbx();
                loadDiredctoryBNFs();
                jcmbBNF.getModel().setSelectedItem(state.getBNF_FILE());
                selectedBNF = state.getBNF_FILE();
            //    initFitnessCmbx();
                jcmbFitnessFunction.getModel().setSelectedItem(state.getFITNESS_FUNCTION());
                jcmbCreationType.setSelectedIndex(state.getCREATION_TYPE());
            //    initComboBoxes();
                jcmbFold.setSelectedItem(state.getTestFOLD());
                jchbSimplify.setSelected(state.isSIMPLIFICATION());
                jchbFastSimplification.setSelected(state.isFAST_SIMPLIFICATION());
                try{
                jcmbValFold.setSelectedItem(state.getVAL_FOLD());
                }catch(Exception e){                    
                }
                jchbWeightedVoting.setSelected(state.isKNN_WEIGHTED_VOTING());
                jchbWeightedAttributes.setSelected(state.isKNN_WEIGHTED_ATTRIBUTES());
                jchbAttributeSelection.setSelected(state.isKNN_ATTRIBUTES_SELECTION());
                jftfMinKNN.setValue(state.getKNN_MIN());
                jfmtMaxKnns.setValue(state.getKNN_MAX());
                jfmtConsideredNeigbhours.setValue(state.getNR_OF_CONSIDERED_NEIGBHOURS());
                jchbSave.setSelected(state.isAUTO_SAVE());
                jtxfMail.setText(state.getRECIPIENTS());
                nrOfFolds = state.getNR_OF_FOLDS();
                jftfTournamentMembers.setValue(state.getNR_OF_TOURNAMNET_MEMBERS());
                JftfDT_EntropyThreshold.setValue(state.getDT_ENTROPY_THRESHOLD());
                JftfDT_ScoreThreshold.setValue(state.getDT_SCORE_THRESHOLD());
                jftfForrest_Size.setValue(state.getRANDOM_FOREST_SIZE());
                jftfMaxTreeSize.setValue(state.getMAX_TREE_SIZE());
                JftfParameter1.setValue(state.getPARAMETER_1());
                JftfParameter2.setValue(state.getPARAMETER_2());
                JftfParameter3.setValue(state.getPARAMETER_3());
                JftfParameter4.setValue(state.getPARAMETER_4());
                
                
                jchbZeroR.setSelected(state.isZeroR());
                jchbJ48.setSelected(state.isJ48());
                jchbSimpleCart.setSelected(state.isSimpleCart());
                jchbRepTree.setSelected(state.isREPTree());
                jchbMLP.setSelected(state.isMLP());
                jchbSVM.setSelected(state.isSVM());
                jchbRandomForest.setSelected(state.isRandomForest());
                jchbZeroRReg.setSelected(state.isZeroRReg());
                jchbLinearRegression.setSelected(state.isLinearRegression());
                jchbPaceRegression.setSelected(state.isPaceRegression());
                jchbREPTreeReg.setSelected(state.isReptreeREG());
                jchbBaggingJ48.setSelected(state.isBaggingJ48());
                jchbM5PRegTree.setSelected(state.isM5PRegTree());
                jchbM5PModelTree.setSelected(state.isM5PModelTree());
                jchbMLPReg.setSelected(state.isMLPReg());
                jchbRBF.setSelected(state.isRBF());
                jchbSVMReg.setSelected(state.isSVMReg());
                jchbRuleExtractFromRF.setSelected(state.isRULE_EXTRACT_FROM_RF());
                jchbRuleExtractionBaggedM5P.setSelected(state.isRULE_EXTRACTION_FROM_M5PBag());
                jchbBaggedM5P.setSelected(state.isBaggedM5P());
                jchbOracleCoachingTest.setSelected(state.isORACLE_COACHING_TEST());
                jchbLaplace.setSelected(state.isLAPLACE());
                jchbEXPUseValidationFold.setSelected(state.isEXP_VAL_FOLDS());
                jchbTreeInjection.setSelected(state.isUSE_GP_INJECTION());
                
                jchbR_Training.setSelected(state.isR_ACC());
                jchbR_ACC.setSelected(state.isR_ACC());
                jchbR_AUC.setSelected(state.isR_AUC());
                jchbR_BRI.setSelected(state.isR_BRI());
                jchbR_BRE.setSelected(state.isR_BRE());
                jchbR_MAE.setSelected(state.isR_MAE());
                jchbR_RMSE.setSelected(state.isR_RMSE());
                jchbR_CORR.setSelected(state.isR_CORR());
                jchbR_MAPE.setSelected(state.isR_MAPE());
                jchbR_MUAPE.setSelected(state.isR_MUAPE());
                jchbR_Length.setSelected(state.isR_LENGTH());

                jtxfCustomClassifcation.setText(state.getCUSTOM_METRICS());
                jtxtfCustomRegression.setText(state.getCUSTOM_REG_METRICS());
               oi.close();
            }else{
                
                return;
            }
        } catch (IOException ex) {

        } catch (ClassNotFoundException ex) {
  
        } 
    }
    private void saveGuiState(){
        ObjectOutputStream oi = null;        
        try {            
            oi = new ObjectOutputStream(new FileOutputStream("GuiState.dat"));            
            oi.writeObject(getAdvancedOptions());
        } catch (IOException ex) {
            ErrorManager.getInstance().reportError(ex);
        } finally {
            try {
                oi.close();
            } catch (IOException ex) {
            
            }
        }        
    }

     private void loadDiredctoryARFFs() {
        String directoryName;
        File directory;
        File[] files;

        directory = new File("."+File.separatorChar+"Datasets"); 
         FileFilter filter = new FileFilter() {

             public String getDescription() {
                 return "Image files";
             }

             public boolean accept(File f) {
                 if (f.isDirectory()) {
                     return false;
                 }
                 if (f.getName().endsWith(".arff")) {
                     return true;
                 }
                 if (f.getName().endsWith(".png")) {
                     return true;
                 }
                 return false;
             }
         };
         files = directory.listFiles(filter);
         String[] names = new String[files.length];

         for (int i = 0; i < names.length; i++) {
             names[i]=files[i].getName();

         }
            jcmbDataFile.setModel(new DefaultComboBoxModel(names));
            ComboBoxModel m = jcmbDataFile.getModel();
         for (int i = 0; i < m.getSize(); i++) {
             if (m.getElementAt(i).equals(selectedFile)) {
                 jcmbDataFile.getModel().setSelectedItem(selectedFile);
                 break;
             }
         }
          //  jcmbDataFile = new JComboBox(files);
    }    
     private void loadDiredctoryBNFs() {
        String directoryName;
        File directory;
        File[] files;

        directory = new File("."+File.separatorChar+"BNFs"); 
         FileFilter filter = new FileFilter() {

             public String getDescription() {
                 return "BNFs";
             }

             public boolean accept(File f) {
                 if (f.isDirectory()) {
                     return false;
                 }
                 if (f.getName().endsWith(".txt")) {
                     return true;
                 }
                 if (f.getName().endsWith(".png")) {
                     return true;
                 }
                 return false;
             }
         };
         files = directory.listFiles(filter);
         bnfs = new String[files.length];
                       
         for (int i = 0; i < bnfs.length; i++) {
             bnfs[i]=files[i].getName();

         }
         Arrays.sort(bnfs);    
           /* jcmbBNF.setModel(new DefaultComboBoxModel(bnfs));*/
    }       
   
    private void initBnfCmbx() {
        int nrOfcats = currentData.getNrOfCategorialColumns();
        int nrOfcons = currentData.getNrOfContinousColumns();
        boolean task = currentData.isClassificationTask();
        //  cats = nrOfcats > 0;
            cons = nrOfcons > 0;
            taskType=task;
            jcmbBNF.removeAllItems();
            if (currentData.isClassificationTask()) {
                for (int i = 0; i < bnfs.length; i++) {
                    if(!bnfs[i].contains("ression"))
                         jcmbBNF.addItem(bnfs[i]);
                }
            } else {
                for (int i = 0; i < bnfs.length; i++) {
                    if (bnfs[i].contains("egres")||bnfs[i].contains("NN")) {
                        jcmbBNF.addItem(bnfs[i]);
                    }
                }
            }
       // }
    }
     private void initFitnessCmbx(){             
        jcmbFitnessFunction.removeAllItems();
        String[] functions;        
        if(currentData.isClassificationTask())
            functions = FitnessFunction.CLASSIFICATION_FITNESS_FUNCTIONS;
        else
            functions = FitnessFunction.REGRESSION_FITNESS_FUNCTIONS;
        for(int i = 0 ; i< functions.length;i++)
            jcmbFitnessFunction.addItem(functions[i]);
     }
    
    private void initComboBoxes(){
          jcmbFold.removeAllItems(); 
          jcmbFold.addItem("NONE");
          for(String s:currentData.getFoldNames()){
            jcmbFold.addItem(s);
          }
          jcmbFold.addItem("ALL");          
          jcmbValFold.removeAllItems();  
        
          jcmbValFold.addItem("NONE");
          for(String s:currentData.getFoldNames()){
            jcmbValFold.addItem(s);
          }        
          jcmbFold.setSelectedItem("ALL");
          //jcmbFold.setSelectedItem("TEST");
    }     
    private void initDesktopPane(){
        this.remove(jdtpMain);
        
        JLabel jlblImage = new javax.swing.JLabel();
        jlblImage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grex/Graphics/pics/G-Rex.jpg")));         
        jdtpMain =new MyDesktopPane(((ImageIcon) jlblImage.getIcon()).getImage());//  sp.getImage());//new javax.swing.ImageIcon(getClass().getResource("/grex/Graphics/pics/g-rex.jpg")).getImage());
        this.add(jdtpMain,BorderLayout.CENTER);
        /*
        
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(tabOptions, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 450, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(layout.createSequentialGroup()
                        .addContainerGap()
                        .add(tabFile, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jdtpMain, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(layout.createSequentialGroup()
                        .add(jdtpMain, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .add(1, 1, 1))
                    .add(layout.createSequentialGroup()
                        .add(tabFile, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(tabOptions, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 600, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );*/
    }

    private Options getAdvancedOptions(){ 
        Options ops=getFileOptions();        
        ops.setGENERATIONS (((Integer)(jftfGenerations.getValue())).intValue());
        ops.setPOPULATION_SIZE(((Integer)(jftfPopulation.getValue())).intValue());
        ops.setFITNESS_FUNCTION(jcmbFitnessFunction.getSelectedItem().toString());
        ops.setPUNISHMENT_FOR_LENGTH((Double)jftfLengthPunishment.getValue());
        ops.setGENERATIONS(((Integer)(jftfGenerations.getValue())).intValue());        
        ops.setCROSSOVER_PROBABILITY((Double) JftfCrossover.getValue());
        ops.setMUTATION_PROBABILITY((Double) jftfMutation.getValue());
        ops.setBATCH_SIZE((Integer)jftfBatchSize.getValue());
        ops.setTRAIN_IMPORTENS((Double)jftfTrainImportance.getValue());
        ops.setVAL_IMPORTENS((Double)jftfValImportance.getValue());
        ops.setCREATION_TYPE(jcmbCreationType.getSelectedIndex());
        if(jcmbCreationType.getSelectedIndex()==3)
            ops.setUSE_GP_INJECTION(true);
        if(jcmbCreationType.getSelectedIndex()==4)
            ops.setSTART_FROM_RANDOMFOREST(true); 
        ops.setMAX_CREATION_DEPTH((Integer)jftfCreationDepth.getValue());
        ops.setSIMPLIFICATION(jchbSimplify.isSelected());
        ops.setFAST_SIMPLIFICATION(jchbFastSimplification.isSelected());
        ops.setELITISM(jchbElitism.isSelected());
        ops.setSIMPLIFICATION_BATCH((Integer) jftfSimpBatchSize.getValue());
        ops.setSIMPLIFICATION_GENERATIONS((Integer)jftfSimpGenerations.getValue());
        ops.setSIMPLIFICATION_POPULATION((Integer)jftfSimpPopulation.getValue());
        if(currentData!=null){
        ops.setFOLD_SEED(currentData.getFoldSeed());
        ops.setNR_OF_FOLDS(currentData.getFoldNames().size());
        }
        
        ops.setVAL_FOLD(jcmbValFold.getSelectedItem().toString());
        ops.setTestFOLD(jcmbFold.getSelectedItem().toString());
        ops.setSTOP_WITHOUT_IMPROVMENT((Integer)jftfPersistence.getValue());
        ops.setAUTO_SAVE(jchbSave.isSelected());
        ops.setRECIPIENTS(jtxfMail.getText());       
        ops.setSELECTION_IMPORTANCE((Double) jftfTrainImportance.getValue());
        ops.setKNN_MAX((Integer)jfmtMaxKnns.getValue());
        ops.setKNN_MIN((Integer)jftfMinKNN.getValue());
        ops.setKNN_WEIGHTED_VOTING(jchbWeightedVoting.isSelected());
        ops.setKNN_WEIGHTED_ATTRIBUTES(jchbWeightedAttributes.isSelected());
        ops.setKNN_ATTRIBUTES_SELECTION(jchbAttributeSelection.isSelected());
        ops.setNR_OF_CONSIDERED_NEIGBHOURS((Integer)jfmtConsideredNeigbhours.getValue());
        if(dataFrame != null)
            ops.setNR_OF_FOLDS(dataFrame.getNrOfFolds());
        ops.setNR_OF_TOURNAMNET_MEMBERS((Integer) jftfTournamentMembers.getValue());
        ops.setDT_ENTROPY_THRESHOLD((Double)JftfDT_EntropyThreshold.getValue());
        ops.setDT_SCORE_THRESHOLD((Double) JftfDT_ScoreThreshold.getValue());
        ops.setRANDOM_FOREST_SIZE((Integer)jftfForrest_Size.getValue());
        ops.setMAX_TREE_SIZE((Integer)jftfMaxTreeSize.getValue());
        ops.setPARAMETER_1((Double)JftfParameter1.getValue());
        ops.setPARAMETER_2((Double)JftfParameter2.getValue());
        ops.setPARAMETER_3((Double)JftfParameter3.getValue());
        ops.setPARAMETER_4((Double)JftfParameter4.getValue());
        if(currentData.isClassificationTask())
            ops.setPROBLEM_TYPE(Options.CLASSIFICATION);
        else
            ops.setPROBLEM_TYPE(Options.REGRESSION);
        currentData.setValFold(jcmbValFold.getSelectedItem().toString());
        ops.setNR_OF_FOLDS(nrOfFolds);
        
        ops.setZeroR(jchbZeroR.isSelected());
        ops.setJ48(jchbJ48.isSelected());
        ops.setSimpleCart(jchbSimpleCart.isSelected());
        ops.setREPTree(jchbRepTree.isSelected());
        ops.setMLP(jchbMLP.isSelected());
        ops.setSVM(jchbSVM.isSelected());
        ops.setRandomForest(jchbRandomForest.isSelected());
        ops.setZeroRReg(jchbZeroRReg.isSelected());
        ops.setLinearRegression(jchbLinearRegression.isSelected());
        ops.setPaceRegression(jchbPaceRegression.isSelected());
        ops.setReptreeREG(jchbREPTreeReg.isSelected());
        ops.setM5PRegTree(jchbM5PRegTree.isSelected());
        ops.setM5PModelTree(jchbM5PModelTree.isSelected());
        ops.setMLPReg(jchbMLPReg.isSelected());
        ops.setRBF(jchbRBF.isSelected());
        ops.setSVMReg(jchbSVMReg.isSelected());
        ops.setRULE_EXTRACT_FROM_RF(jchbRuleExtractFromRF.isSelected());
        ops.setRULE_EXTRACTION_FROM_M5PBag(jchbRuleExtractionBaggedM5P.isSelected());
        ops.setBaggedM5P(jchbBaggedM5P.isSelected());
        ops.setBaggingJ48(jchbBaggingJ48.isSelected());
        ops.setORACLE_COACHING_TEST(jchbOracleCoachingTest.isSelected());
        ops.setLAPLACE(jchbLaplace.isSelected());
        ops.setEXP_VAL_FOLDS(jchbEXPUseValidationFold.isSelected());
        ops.setUSE_GP_INJECTION(jchbTreeInjection.isSelected());
        
        ops.setREPORT_TRAINING(jchbR_Training.isSelected());
        ops.setR_ACC(jchbR_ACC.isSelected());
        ops.setR_AUC(jchbR_AUC.isSelected());
        ops.setR_BRI(jchbR_BRI.isSelected());
        ops.setR_BRE(jchbR_BRE.isSelected());
        ops.setR_MAE(jchbR_MAE.isSelected());
        ops.setR_RMSE(jchbR_RMSE.isSelected());
        ops.setR_CORR(jchbR_CORR.isSelected());
        ops.setR_MAPE(jchbR_MAPE.isSelected());
        ops.setR_MUAPE(jchbR_MUAPE.isSelected());
        ops.setR_LENGTH(jchbR_Length.isSelected());
        ops.setCUSTOM_METRICS(jtxfCustomClassifcation.getText());
        ops.setCUSTOM_REG_METRICS(jtxtfCustomRegression.getText());
        return ops;
    }
    private Options getFileOptions(){
        Options options = new Options();        
        options.setDATA_FILE((String)jcmbDataFile.getSelectedItem());//jfcData.getDirectory() + jfcData.getFile());        
        options.setBNF_FILE((String)jcmbBNF.getSelectedItem());//jfcBNF.getDirectory() + jfcBNF.getFile());
        options.setMARKER_USED(jcbUseMarkerColumn.isSelected());   
        return options;
    }
    
    

    public void onError(Exception e){
        errorCount++;
        int tCount=tabOptions.getTabCount()-1;        
        txaErrorLog.setForeground(Color.RED);
        StackTraceElement[] ste = e.getStackTrace();
        String trace="";
        for (int i = 0; i < ste.length; i++) {
            trace += ste[i] +"\n";

        }

        txaErrorLog.insert(errorCount +": "+e.getClass().getName()+" "+ e.getMessage()+"\n" + trace, 0);        
        //skriv ut tiden
        tabOptions.setForegroundAt(tCount, Color.RED);
        tabOptions.setTitleAt(tCount, "Error log");
        
    }

    
    public void changeUserMode(boolean expertMode) { 
        if(!expertMode)
            setAutoSetting();
        jsldComp.setEnabled(!expertMode);
        jsldSearch.setEnabled(!expertMode);
        
        
        jpnlAutoMode.setEnabled(!expertMode);
        for(Component c:jpnlAutoMode.getComponents())
            c.setEnabled(!expertMode);
;
        for(Component c:jpnlGPSettings.getComponents())            
            c.setEnabled(expertMode);
        for(Component c:jpnlRunSettings.getComponents())            
            c.setEnabled(expertMode);
        for(Component c:jpnlSimplification.getComponents())            
            c.setEnabled(expertMode);
        
       
        jbtnEditBnf.setEnabled(expertMode);
        jcbUseMarkerColumn.setEnabled(expertMode);
        jchbAttributeSelection.setEnabled(expertMode);
        jchbElitism.setEnabled(expertMode);
        jchbSave.setEnabled(expertMode);
        jchbSimplify.setEnabled(expertMode);
        jchbWeightedAttributes.setEnabled(expertMode);
        jchbWeightedVoting.setEnabled(expertMode);
        jcmbBNF.setEnabled(expertMode);
        jcmbCreationType.setEnabled(expertMode);

        jcmbFitnessFunction.setEnabled(expertMode);

        jcmbValFold.setEnabled(expertMode);
 
    }
    
    

     private void setAutoSetting(){
         
        int search = jsldSearch.getValue();
        int comp = jsldComp.getValue();
        jftfPopulation.setValue(search *20 + 10);
        jftfGenerations.setValue((search *1 + 10));
        jftfLengthPunishment.setValue((0.1 - 0.1*(1.0/100 * jsldComp.getValue())));
        int gen = (Integer) jftfGenerations.getValue();
        jftfPersistence.setValue((5 + gen/10));
        jftfCreationDepth.setValue(3 + 5 * comp/100);
        jftfTournamentMembers.setValue(3 + (100-search)/51);
        jcmbFitnessFunction.setSelectedItem(0);
        jchbSimplify.setSelected(false);
        jchbFastSimplification.setSelected(true);
     }     

        
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private class MyChangeListener implements ChangeListener
    {

        public void stateChanged(ChangeEvent e) {
            int tCount=tabOptions.getTabCount()-1;

            if(tabOptions.getSelectedIndex()==tCount)            
                tabOptions.setForegroundAt(tCount, Color.BLACK);
            tabOptions.setTitleAt(tCount, "Error log");            
        }
    }
        private void setLookAndFeel(){
        try {
                // Set cross-platform Java L&F (also called "Metal")
            UIManager.setLookAndFeel(
                UIManager.getSystemLookAndFeelClassName());            
        } 
        catch (UnsupportedLookAndFeelException e) {
           // handle exception
        }
        catch (ClassNotFoundException e) {
           // handle exception
        }
        catch (InstantiationException e) {
           // handle exception
        }
        catch (IllegalAccessException e) {
           // handle exception
        }
    }
    private void initDataset(){
       // File f = new File((getClass().getResourceAsStream("/grex/Datasets"))); //hypothyroid.arff")));

    }
    
    public void startNewGREX(Options o,ArffTableModel af,boolean closeWhenReady){
        startNewGREX(o, null, af, closeWhenReady);
    }
    
    public void startNewGREX(Options o,EvolutionListener l,ArffTableModel af,boolean closeWhenReady){
        //ArffTableModel af =new ArffTableModel(o.getDATA_FILE(),o.getNR_OF_FOLDS(),o.getFOLD_SEED());
       
       af.setValFold(o.getVAL_FOLD());
       IPredictiveModel extractionModel=null;
        if (o.isRULE_EXTRACT_FROM_RF() && o.getPROBLEM_TYPE() == Options.CLASSIFICATION) {
                    extractionModel = new GrexJ48Bag(af);// GrexRandomForest(data);
        }
        if (o.isRULE_EXTRACTION_FROM_M5PBag() && o.getPROBLEM_TYPE() == Options.REGRESSION) {
                    extractionModel  = new GrexM5PBag(af);
        } 
       evolutionaryProces = new EvolutionProcess(af,o,extractionModel);//currentData.clone(),o); 
       if(l!=null)
            evolutionaryProces.addEvolutionListener(l);
       EvolutionFrame ef = new EvolutionFrame(evolutionaryProces,o,closeWhenReady);   
       
       addInternalFrame(ef);       
       evolutionaryProces.startEvolution();
    }
    
    private ArrayList<String> getDirectoryFiles(String directoryName) {
        File directory;
        File[] files;

        directory = new File(directoryName); 
         FileFilter filter = new FileFilter() {

             public String getDescription() {
                 return "Arrfs";
             }

             public boolean accept(File f) {
                 if (f.isDirectory()) {
                     return false;
                 }
                 if (f.getName().endsWith(".arff")) {
                     return true;
                 }
                 /*if (f.getName().endsWith(".png")) {
                     return true;
                 }//*/
                 return false;
             }
         };
         files = directory.listFiles(filter);
         ArrayList<String> fileNames = new ArrayList<String>();
                       
         for (int i = 0; i < files.length; i++) {
             fileNames.add(files[i].getName());

         }
         Collections.sort(fileNames);
         return fileNames;
           /* jcmbBNF.setModel(new DefaultComboBoxModel(bnfs));*/
    }   
    public void addExperiment(){
        expermienter.addExperiment(getAdvancedOptions(), currentData.clone());
    }
    
    public void loadExperimentsFromFolder(){
                String directory = "";
        if (jfcBNF != null) {
            directory = jfcBNF.getDirectory();

        }

        if (jfcBNF != null) {
            directory = jfcBNF.getDirectory();

        }
        JFileChooser jf = new JFileChooser(directory);
        jf.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        jf.showDialog(this, "Select Directory");
        
        String path = jf.getSelectedFile().getAbsolutePath();

        ArrayList<String> files = getDirectoryFiles(path);

        for (String f : files) {
            System.out.println(f);
            String dataPath = path + File.separatorChar + f;
            System.out.println(dataPath);
            


            Options ops = getAdvancedOptions();
            currentData = new ArffTableModel(dataPath, ops.getNR_OF_FOLDS(), 1);
            ops.setRUN_GREX(true);
            ops.setDATA_FILE(dataPath);
            expermienter.addExperiment(ops, currentData);
        }
        tabOptions.setSelectedComponent(jpnlExperimenter);
    }
    
    public void addTimeSeriesExperimentFromFolder(){
                String directory = "";
        if (jfcBNF != null) {
            directory = jfcBNF.getDirectory();

        }

        if (jfcBNF != null) {
            directory = jfcBNF.getDirectory();

        }
        JFileChooser jf = new JFileChooser(directory);
        jf.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        jf.showDialog(this, "Select Directory");
        
        String path = jf.getSelectedFile().getAbsolutePath();

        ArrayList<String> files = getDirectoryFiles(path);

        for (String f : files) {
            System.out.println(f);
            String dataPath = path + File.separatorChar + f;
            System.out.println(dataPath);
            currentData = new ArffTableModel(dataPath, 4, 1);

            currentData.initTimeSeriesFoldColumn(4);

            Options ops = getAdvancedOptions();
            ops.setRUN_GREX(true);
            ops.setTestFOLD("TEST");
            ops.setDATA_FILE(dataPath);
            expermienter.addExperiment(ops, currentData);
        }
        tabOptions.setSelectedComponent(jpnlExperimenter);

    }
    
    
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jdtpMain = new javax.swing.JDesktopPane();
        jFormattedTextField1 = new javax.swing.JFormattedTextField();
        jCheckBox1 = new javax.swing.JCheckBox();
        jCheckBox2 = new javax.swing.JCheckBox();
        jpnlSettings = new javax.swing.JPanel();
        tabOptions = new javax.swing.JTabbedPane();
        tabAuto = new javax.swing.JPanel();
        jpnlAutoMode = new javax.swing.JPanel();
        jlblA1 = new javax.swing.JLabel();
        jlblA2 = new javax.swing.JLabel();
        jsldSearch = new javax.swing.JSlider();
        jlblA3 = new javax.swing.JLabel();
        jlblA4 = new javax.swing.JLabel();
        jsldComp = new javax.swing.JSlider();
        tabExpert = new javax.swing.JPanel();
        jpnlGPSettings = new javax.swing.JPanel();
        jftfGenerations = new javax.swing.JFormattedTextField();
        jlblE1 = new javax.swing.JLabel();
        jftfPopulation = new javax.swing.JFormattedTextField();
        jlblE2 = new javax.swing.JLabel();
        JftfCrossover = new javax.swing.JFormattedTextField();
        lblE3 = new javax.swing.JLabel();
        jftfMutation = new javax.swing.JFormattedTextField();
        lblE4 = new javax.swing.JLabel();
        jftfCreationDepth = new javax.swing.JFormattedTextField();
        lblE5 = new javax.swing.JLabel();
        lblE6 = new javax.swing.JLabel();
        jcmbCreationType = new javax.swing.JComboBox();
        lblE7 = new javax.swing.JLabel();
        jcmbFitnessFunction = new javax.swing.JComboBox();
        jlblPDFRuleQuality = new javax.swing.JLabel();
        jlblPDFRegOptimization = new javax.swing.JLabel();
        lblE8 = new javax.swing.JLabel();
        jftfTournamentMembers = new javax.swing.JFormattedTextField();
        lblE9 = new javax.swing.JLabel();
        jftfLengthPunishment = new javax.swing.JFormattedTextField();
        lblE10 = new javax.swing.JLabel();
        jchbElitism = new javax.swing.JCheckBox();
        lblE13 = new javax.swing.JLabel();
        jftfMaxTreeSize = new javax.swing.JFormattedTextField();
        jLabel3 = new javax.swing.JLabel();
        jchbLaplace = new javax.swing.JCheckBox();
        jpnlSimplification = new javax.swing.JPanel();
        lblE15 = new javax.swing.JLabel();
        jchbSimplify = new javax.swing.JCheckBox();
        jlbSimpGenerations = new javax.swing.JLabel();
        jftfSimpGenerations = new javax.swing.JFormattedTextField();
        jlblSimpBatch = new javax.swing.JLabel();
        jftfSimpBatchSize = new javax.swing.JFormattedTextField();
        jlblSimpPopulation = new javax.swing.JLabel();
        jftfSimpPopulation = new javax.swing.JFormattedTextField();
        jLabel1 = new javax.swing.JLabel();
        jchbFastSimplification = new javax.swing.JCheckBox();
        jlblPDFSimplification = new javax.swing.JLabel();
        jpnlRunSettings = new javax.swing.JPanel();
        lblE12 = new javax.swing.JLabel();
        jftfPersistence = new javax.swing.JFormattedTextField();
        jftfBatchSize = new javax.swing.JFormattedTextField();
        lblE11 = new javax.swing.JLabel();
        jchbSave = new javax.swing.JCheckBox();
        lblE14 = new javax.swing.JLabel();
        jpnlAdvancedSettings = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jpnlSettingsEx = new javax.swing.JPanel();
        jchbOracleCoachingTest = new javax.swing.JCheckBox();
        jlblPDFOracle = new javax.swing.JLabel();
        jpnlRegressionExtraction = new javax.swing.JPanel();
        jchbRuleExtractionBaggedM5P = new javax.swing.JCheckBox();
        jlblPDFAToolForFlexibleRuleExtraction = new javax.swing.JLabel();
        jpnlClassificationExtraction = new javax.swing.JPanel();
        jchbRuleExtractFromRF = new javax.swing.JCheckBox();
        jlblPDFRuleExtractAcc = new javax.swing.JLabel();
        jlblPDFRuleExtractBrier = new javax.swing.JLabel();
        jpnlOther = new javax.swing.JPanel();
        jchbTreeInjection = new javax.swing.JCheckBox();
        jlblPDFSimplification1 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jLabel34 = new javax.swing.JLabel();
        jftfMinKNN = new javax.swing.JFormattedTextField();
        jLabel33 = new javax.swing.JLabel();
        jfmtMaxKnns = new javax.swing.JFormattedTextField();
        jLabel16 = new javax.swing.JLabel();
        jchbWeightedVoting = new javax.swing.JCheckBox();
        jlblPDFGKnn = new javax.swing.JLabel();
        jpnlBenchmark = new javax.swing.JPanel();
        jpnlBenchClassification = new javax.swing.JPanel();
        jchbJ48 = new javax.swing.JCheckBox();
        jchbSimpleCart = new javax.swing.JCheckBox();
        jchbRepTree = new javax.swing.JCheckBox();
        jchbZeroR = new javax.swing.JCheckBox();
        jchbMLP = new javax.swing.JCheckBox();
        jchbSVM = new javax.swing.JCheckBox();
        jchbRandomForest = new javax.swing.JCheckBox();
        jchbBaggingJ48 = new javax.swing.JCheckBox();
        jpnlBenchRegression = new javax.swing.JPanel();
        jchbZeroRReg = new javax.swing.JCheckBox();
        jchbLinearRegression = new javax.swing.JCheckBox();
        jchbM5PRegTree = new javax.swing.JCheckBox();
        jchbM5PModelTree = new javax.swing.JCheckBox();
        jchbREPTreeReg = new javax.swing.JCheckBox();
        jchbPaceRegression = new javax.swing.JCheckBox();
        jchbMLPReg = new javax.swing.JCheckBox();
        jchbSVMReg = new javax.swing.JCheckBox();
        jchbRBF = new javax.swing.JCheckBox();
        jchbBaggedM5P = new javax.swing.JCheckBox();
        jpnlReport = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jchbR_AUC = new javax.swing.JCheckBox();
        jchbR_BRI = new javax.swing.JCheckBox();
        jchbR_ACC = new javax.swing.JCheckBox();
        jchbR_BRE = new javax.swing.JCheckBox();
        jtxfCustomClassifcation = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jPanel5 = new javax.swing.JPanel();
        jchbR_MAE = new javax.swing.JCheckBox();
        jchbR_RMSE = new javax.swing.JCheckBox();
        jchbR_CORR = new javax.swing.JCheckBox();
        jchbR_MAPE = new javax.swing.JCheckBox();
        jchbR_MUAPE = new javax.swing.JCheckBox();
        jtxtfCustomRegression = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jchbR_Training = new javax.swing.JCheckBox();
        jchbR_Length = new javax.swing.JCheckBox();
        jpnlExperimenter = new javax.swing.JPanel();
        jpnlTabTest = new javax.swing.JPanel();
        jbtnDecisionTree = new javax.swing.JButton();
        jbtnRandomForest = new javax.swing.JButton();
        JftfDT_EntropyThreshold = new javax.swing.JFormattedTextField();
        JftfDT_ScoreThreshold = new javax.swing.JFormattedTextField();
        jLabel35 = new javax.swing.JLabel();
        jLabel36 = new javax.swing.JLabel();
        jftfForrest_Size = new javax.swing.JFormattedTextField();
        jLabel38 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jPanel9 = new javax.swing.JPanel();
        jLabel39 = new javax.swing.JLabel();
        JftfParameter1 = new javax.swing.JFormattedTextField();
        JftfParameter2 = new javax.swing.JFormattedTextField();
        JftfParameter3 = new javax.swing.JFormattedTextField();
        JftfParameter4 = new javax.swing.JFormattedTextField();
        jLabel40 = new javax.swing.JLabel();
        jLabel41 = new javax.swing.JLabel();
        jLabel42 = new javax.swing.JLabel();
        jftfTrainImportance = new javax.swing.JFormattedTextField();
        jftfValImportance = new javax.swing.JFormattedTextField();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jbtnInjectionGP = new javax.swing.JButton();
        jbtnEvolveRandomforest = new javax.swing.JButton();
        jbtnSelectDirectory = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jchbWeightedAttributes = new javax.swing.JCheckBox();
        jLabel31 = new javax.swing.JLabel();
        jchbAttributeSelection = new javax.swing.JCheckBox();
        jfmtConsideredNeigbhours = new javax.swing.JFormattedTextField();
        jLabel15 = new javax.swing.JLabel();
        jtxfMail = new javax.swing.JTextField();
        jLabel29 = new javax.swing.JLabel();
        jpnlTabError = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        txaErrorLog = new javax.swing.JTextArea();
        tabFile = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jbtnLoadFile = new javax.swing.JButton();
        jbtnLoadBNF = new javax.swing.JButton();
        jcmbBNF = new javax.swing.JComboBox();
        jcmbDataFile = new javax.swing.JComboBox();
        jbtnSetupFile = new javax.swing.JButton();
        jbtnEditBnf = new javax.swing.JButton();
        jcmbFold = new javax.swing.JComboBox();
        jcmbValFold = new javax.swing.JComboBox();
        jcbUseMarkerColumn = new javax.swing.JCheckBox();
        jbtnAdvancedCreate = new javax.swing.JButton();
        jchbEXPUseValidationFold = new javax.swing.JCheckBox();
        jlblPDFGPFrameWork = new javax.swing.JLabel();

        setTitle("-REX 9.0"); // NOI18N
        setBounds(new java.awt.Rectangle(0, 0, 1200, 600));
        setMinimumSize(new java.awt.Dimension(400, 200));
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        jdtpMain.setBackground(new java.awt.Color(255, 255, 255));
        jdtpMain.setFocusable(false);
        jdtpMain.setMaximumSize(new java.awt.Dimension(800, 600));
        jdtpMain.setMinimumSize(new java.awt.Dimension(200, 100));
        jdtpMain.setPreferredSize(new java.awt.Dimension(800, 400));
        jdtpMain.setRequestFocusEnabled(false);

        jFormattedTextField1.setText("0");
        jFormattedTextField1.setBounds(-240, 320, 12, 20);
        jdtpMain.add(jFormattedTextField1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCheckBox1.setText("jCheckBox1");
        jCheckBox1.setBounds(-220, 410, 81, 23);
        jdtpMain.add(jCheckBox1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jCheckBox2.setText("jCheckBox2");
        jCheckBox2.setBounds(-430, 240, 81, 23);
        jdtpMain.add(jCheckBox2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        getContentPane().add(jdtpMain, java.awt.BorderLayout.CENTER);

        tabOptions.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
        tabOptions.setDoubleBuffered(true);
        tabOptions.setMaximumSize(new java.awt.Dimension(600, 600));
        tabOptions.setMinimumSize(new java.awt.Dimension(200, 400));
        tabOptions.setName("tabBenchmark"); // NOI18N
        tabOptions.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                tabOptionsStateChanged(evt);
            }
        });

        jpnlAutoMode.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jpnlAutoMode.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jlblA1.setText("Fast Search"); // NOI18N
        jpnlAutoMode.add(jlblA1, new org.netbeans.lib.awtextra.AbsoluteConstraints(17, 0, 60, 20));

        jlblA2.setText("Extensive search"); // NOI18N
        jpnlAutoMode.add(jlblA2, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 0, -1, 21));

        jsldSearch.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jsldSearchStateChanged(evt);
            }
        });
        jpnlAutoMode.add(jsldSearch, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 400, 25));

        jlblA3.setText("Comprehensibillity"); // NOI18N
        jpnlAutoMode.add(jlblA3, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 50, 90, -1));

        jlblA4.setText("Accuracy"); // NOI18N
        jpnlAutoMode.add(jlblA4, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 50, -1, -1));

        jsldComp.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jsldCompStateChanged(evt);
            }
        });
        jpnlAutoMode.add(jsldComp, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, 400, -1));

        org.jdesktop.layout.GroupLayout tabAutoLayout = new org.jdesktop.layout.GroupLayout(tabAuto);
        tabAuto.setLayout(tabAutoLayout);
        tabAutoLayout.setHorizontalGroup(
            tabAutoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(tabAutoLayout.createSequentialGroup()
                .addContainerGap()
                .add(jpnlAutoMode, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 415, Short.MAX_VALUE)
                .addContainerGap())
        );
        tabAutoLayout.setVerticalGroup(
            tabAutoLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(tabAutoLayout.createSequentialGroup()
                .add(10, 10, 10)
                .add(jpnlAutoMode, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 110, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
        );

        tabOptions.addTab("Auto", tabAuto);

        tabExpert.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
        tabExpert.setMaximumSize(new java.awt.Dimension(800, 600));
        tabExpert.setMinimumSize(new java.awt.Dimension(200, 200));

        jpnlGPSettings.setBorder(javax.swing.BorderFactory.createTitledBorder("GP settings"));

        jftfGenerations.setText("100"); // NOI18N
        jftfGenerations.setToolTipText("Maximum number of gererations."); // NOI18N
        jftfGenerations.setValue(new Integer(50));

        jlblE1.setText("Generations"); // NOI18N

        jftfPopulation.setText("500"); // NOI18N
        jftfPopulation.setToolTipText("Population size (number of rules evaluated in the evolution)."); // NOI18N
        jftfPopulation.setValue(new Integer(500));

        jlblE2.setText("Population"); // NOI18N

        JftfCrossover.setText("0.8"); // NOI18N
        JftfCrossover.setToolTipText("Crossover probaillity."); // NOI18N
        JftfCrossover.setValue(new Double(0.8));

        lblE3.setText("Crossover"); // NOI18N

        jftfMutation.setText("0.001"); // NOI18N
        jftfMutation.setToolTipText("Mutation probability."); // NOI18N
        jftfMutation.setValue(new Double(0.01));

        lblE4.setText("Mutation"); // NOI18N

        jftfCreationDepth.setText("6"); // NOI18N
        jftfCreationDepth.setToolTipText("Maximum allowed creation depth."); // NOI18N
        jftfCreationDepth.setValue(new Integer(5));

        lblE5.setText("Creation depth"); // NOI18N

        lblE6.setText("Creation Type"); // NOI18N

        jcmbCreationType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Ramped H&H", "Grow", "Variable" }));

        lblE7.setText("Fitness Function"); // NOI18N

        jcmbFitnessFunction.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ACCFitness", "BRIFitness", "AUCFitness", "" }));

        jlblPDFRuleQuality.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grex/Graphics/pics/pdf.gif"))); // NOI18N
        jlblPDFRuleQuality.setToolTipText("Using GP to Increase Rule Quality");
        jlblPDFRuleQuality.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jlblPDFRuleQualityMouseClicked(evt);
            }
        });

        jlblPDFRegOptimization.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grex/Graphics/pics/pdf.gif"))); // NOI18N
        jlblPDFRegOptimization.setToolTipText("Optimization and Evaluation Criteria in GP Regression");
        jlblPDFRegOptimization.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jlblPDFRegOptimizationMouseClicked(evt);
            }
        });

        lblE8.setText("#Tourn. Mem.");

        jftfTournamentMembers.setText("4"); // NOI18N
        jftfTournamentMembers.setToolTipText("# Tournamnet members (0=Roulette Wheel Selection)"); // NOI18N
        jftfTournamentMembers.setValue(new Integer(4));

        lblE9.setText("Parsimony P."); // NOI18N

        jftfLengthPunishment.setText("0.05"); // NOI18N
        jftfLengthPunishment.setToolTipText("Punishment for length. (fitness - rule length * Length P.)."); // NOI18N
        jftfLengthPunishment.setValue(new Double(0.01));

        lblE10.setText("Elitism"); // NOI18N

        jchbElitism.setSelected(true);
        jchbElitism.setToolTipText("Ensure that the best rule is copied into next generation."); // NOI18N

        lblE13.setText("Max Size"); // NOI18N

        jftfMaxTreeSize.setText("100"); // NOI18N
        jftfMaxTreeSize.setToolTipText("Maximum Tree Size. Trees Larger than this size will recive a large penalty."); // NOI18N
        jftfMaxTreeSize.setValue(new Integer(50));
        jftfMaxTreeSize.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jftfMaxTreeSizeActionPerformed(evt);
            }
        });

        jLabel3.setText("LaPlace");

        jchbLaplace.setToolTipText("Wehter to use LaPlace when calculating probabillities");

        org.jdesktop.layout.GroupLayout jpnlGPSettingsLayout = new org.jdesktop.layout.GroupLayout(jpnlGPSettings);
        jpnlGPSettings.setLayout(jpnlGPSettingsLayout);
        jpnlGPSettingsLayout.setHorizontalGroup(
            jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlGPSettingsLayout.createSequentialGroup()
                .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(lblE3)
                    .add(lblE4)
                    .add(lblE5))
                .add(23, 23, 23)
                .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jftfCreationDepth)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jftfMutation, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE)
                    .add(JftfCrossover))
                .add(18, 18, 18)
                .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(jpnlGPSettingsLayout.createSequentialGroup()
                        .add(lblE8)
                        .add(18, 18, 18)
                        .add(jftfTournamentMembers, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 45, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jpnlGPSettingsLayout.createSequentialGroup()
                        .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(lblE9)
                            .add(lblE10))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jftfLengthPunishment, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 45, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jchbElitism))))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jpnlGPSettingsLayout.createSequentialGroup()
                        .add(jLabel3)
                        .add(18, 18, 18)
                        .add(jchbLaplace))
                    .add(jpnlGPSettingsLayout.createSequentialGroup()
                        .add(lblE13)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jftfMaxTreeSize, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 48, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .add(jpnlGPSettingsLayout.createSequentialGroup()
                .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jlblE1)
                    .add(jlblE2))
                .add(37, 37, 37)
                .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(jftfGenerations, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE)
                    .add(jftfPopulation))
                .add(18, 18, 18)
                .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(lblE7)
                    .add(lblE6))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jcmbFitnessFunction, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(jcmbCreationType, 0, 124, Short.MAX_VALUE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jlblPDFRuleQuality)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jlblPDFRegOptimization))
        );
        jpnlGPSettingsLayout.setVerticalGroup(
            jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlGPSettingsLayout.createSequentialGroup()
                .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jftfGenerations, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jlblE1)
                    .add(lblE6)
                    .add(jcmbCreationType, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jlblPDFRegOptimization)
                    .add(jpnlGPSettingsLayout.createSequentialGroup()
                        .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jpnlGPSettingsLayout.createSequentialGroup()
                                .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                                    .add(jftfPopulation, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(jlblE2)
                                    .add(lblE7)
                                    .add(jcmbFitnessFunction, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                                    .add(JftfCrossover, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(lblE3)
                                    .add(lblE8)
                                    .add(jftfTournamentMembers, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                                    .add(jftfMutation, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(lblE4)
                                    .add(lblE9)
                                    .add(jftfLengthPunishment, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(lblE13)
                                    .add(jftfMaxTreeSize, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                            .add(jlblPDFRuleQuality))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jpnlGPSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                                .add(jftfCreationDepth, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(lblE5)
                                .add(lblE10)
                                .add(jLabel3))
                            .add(jchbElitism, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jchbLaplace))))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jpnlSimplification.setBorder(javax.swing.BorderFactory.createTitledBorder("Simplification settings"));

        lblE15.setText("Deep Simplifiction"); // NOI18N

        jchbSimplify.setToolTipText("Simplify rule after evoltuion is completed."); // NOI18N
        jchbSimplify.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jchbSimplifyItemStateChanged(evt);
            }
        });
        jchbSimplify.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jchbSimplifyActionPerformed(evt);
            }
        });

        jlbSimpGenerations.setText("S. Generations"); // NOI18N
        jlbSimpGenerations.setEnabled(false);

        jftfSimpGenerations.setText("50"); // NOI18N
        jftfSimpGenerations.setToolTipText("Generations used in simplification process."); // NOI18N
        jftfSimpGenerations.setEnabled(false);
        jftfSimpGenerations.setValue(new Integer(25));
        jftfSimpGenerations.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jftfSimpGenerationsActionPerformed(evt);
            }
        });

        jlblSimpBatch.setText("S. Batch size"); // NOI18N
        jlblSimpBatch.setEnabled(false);

        jftfSimpBatchSize.setText("2"); // NOI18N
        jftfSimpBatchSize.setToolTipText("Batch size used during simplification."); // NOI18N
        jftfSimpBatchSize.setEnabled(false);
        jftfSimpBatchSize.setValue(new Integer(2));

        jlblSimpPopulation.setText("S. Population"); // NOI18N
        jlblSimpPopulation.setEnabled(false);

        jftfSimpPopulation.setText("500"); // NOI18N
        jftfSimpPopulation.setToolTipText("Populatin size during simplification"); // NOI18N
        jftfSimpPopulation.setEnabled(false);
        jftfSimpPopulation.setValue(new Integer(500));

        jLabel1.setText("Fast Simplification");

        jchbFastSimplification.setSelected(true);

        jlblPDFSimplification.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grex/Graphics/pics/pdf.gif"))); // NOI18N
        jlblPDFSimplification.setToolTipText("Increasing rule extraction comprehensibility");
        jlblPDFSimplification.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jlblPDFSimplificationMouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jpnlSimplificationLayout = new org.jdesktop.layout.GroupLayout(jpnlSimplification);
        jpnlSimplification.setLayout(jpnlSimplificationLayout);
        jpnlSimplificationLayout.setHorizontalGroup(
            jpnlSimplificationLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlSimplificationLayout.createSequentialGroup()
                .add(jpnlSimplificationLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jpnlSimplificationLayout.createSequentialGroup()
                        .add(lblE15)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jchbSimplify)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jlblPDFSimplification)
                        .add(18, 18, 18)
                        .add(jLabel1)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jchbFastSimplification))
                    .add(jpnlSimplificationLayout.createSequentialGroup()
                        .add(jlbSimpGenerations)
                        .add(18, 18, 18)
                        .add(jftfSimpGenerations, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jlblSimpBatch)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jftfSimpBatchSize, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 47, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jlblSimpPopulation)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jftfSimpPopulation, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 47, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(16, Short.MAX_VALUE))
        );
        jpnlSimplificationLayout.setVerticalGroup(
            jpnlSimplificationLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlSimplificationLayout.createSequentialGroup()
                .add(jpnlSimplificationLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jpnlSimplificationLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel1)
                        .add(lblE15))
                    .add(jchbFastSimplification)
                    .add(jchbSimplify)
                    .add(jlblPDFSimplification))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jpnlSimplificationLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jpnlSimplificationLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jftfSimpGenerations, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(jlblSimpBatch)
                        .add(jlbSimpGenerations))
                    .add(jpnlSimplificationLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jftfSimpBatchSize, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(jlblSimpPopulation)
                        .add(jftfSimpPopulation, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .add(0, 10, Short.MAX_VALUE))
        );

        jpnlRunSettings.setBorder(javax.swing.BorderFactory.createTitledBorder("Run settings"));

        lblE12.setText("Persistence"); // NOI18N

        jftfPersistence.setText("50"); // NOI18N
        jftfPersistence.setToolTipText("Stop after X number of generations without improvement."); // NOI18N
        jftfPersistence.setValue(new Integer(20));
        jftfPersistence.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jftfPersistenceActionPerformed(evt);
            }
        });

        jftfBatchSize.setText("1"); // NOI18N
        jftfBatchSize.setToolTipText("Number of consecutive runs, the best rule will be choosen."); // NOI18N
        jftfBatchSize.setValue(new Integer(1));

        lblE11.setText("Batch Size"); // NOI18N

        lblE14.setText("Save results to file"); // NOI18N

        org.jdesktop.layout.GroupLayout jpnlRunSettingsLayout = new org.jdesktop.layout.GroupLayout(jpnlRunSettings);
        jpnlRunSettings.setLayout(jpnlRunSettingsLayout);
        jpnlRunSettingsLayout.setHorizontalGroup(
            jpnlRunSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlRunSettingsLayout.createSequentialGroup()
                .add(lblE11)
                .add(36, 36, 36)
                .add(jftfBatchSize, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 48, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(lblE12)
                .add(16, 16, 16)
                .add(jftfPersistence, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 48, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(12, 12, 12)
                .add(lblE14)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jchbSave)
                .addContainerGap(13, Short.MAX_VALUE))
        );
        jpnlRunSettingsLayout.setVerticalGroup(
            jpnlRunSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlRunSettingsLayout.createSequentialGroup()
                .add(jpnlRunSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jpnlRunSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(lblE11)
                        .add(jftfBatchSize, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(lblE12)
                        .add(jftfPersistence, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(lblE14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jchbSave))
                .add(0, 10, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout tabExpertLayout = new org.jdesktop.layout.GroupLayout(tabExpert);
        tabExpert.setLayout(tabExpertLayout);
        tabExpertLayout.setHorizontalGroup(
            tabExpertLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(tabExpertLayout.createSequentialGroup()
                .addContainerGap()
                .add(tabExpertLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jpnlGPSettings, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(jpnlSimplification, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(jpnlRunSettings, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        tabExpertLayout.setVerticalGroup(
            tabExpertLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(tabExpertLayout.createSequentialGroup()
                .add(10, 10, 10)
                .add(jpnlGPSettings, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jpnlSimplification, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jpnlRunSettings, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(476, Short.MAX_VALUE))
        );

        jpnlRunSettings.getAccessibleContext().setAccessibleName("Run");

        tabOptions.addTab("GP", tabExpert);

        jpnlAdvancedSettings.setLayout(new java.awt.BorderLayout());

        jpnlSettingsEx.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        jchbOracleCoachingTest.setText("Use oracle coaching (All) ");
        jchbOracleCoachingTest.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);

        jlblPDFOracle.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grex/Graphics/pics/pdf.gif"))); // NOI18N
        jlblPDFOracle.setToolTipText("Why Not Use an Oracle When You Got One");
        jlblPDFOracle.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jlblPDFOracleMouseClicked(evt);
            }
        });

        jpnlRegressionExtraction.setBorder(javax.swing.BorderFactory.createTitledBorder("Regression"));

        jchbRuleExtractionBaggedM5P.setText("Extract from Bagged M5P");

        jlblPDFAToolForFlexibleRuleExtraction.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grex/Graphics/pics/pdf.gif"))); // NOI18N
        jlblPDFAToolForFlexibleRuleExtraction.setToolTipText("GP - a tool for flexible rule extraction");
        jlblPDFAToolForFlexibleRuleExtraction.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jlblPDFAToolForFlexibleRuleExtractionMouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jpnlRegressionExtractionLayout = new org.jdesktop.layout.GroupLayout(jpnlRegressionExtraction);
        jpnlRegressionExtraction.setLayout(jpnlRegressionExtractionLayout);
        jpnlRegressionExtractionLayout.setHorizontalGroup(
            jpnlRegressionExtractionLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlRegressionExtractionLayout.createSequentialGroup()
                .addContainerGap()
                .add(jchbRuleExtractionBaggedM5P)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jlblPDFAToolForFlexibleRuleExtraction)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jpnlRegressionExtractionLayout.setVerticalGroup(
            jpnlRegressionExtractionLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlRegressionExtractionLayout.createSequentialGroup()
                .add(jpnlRegressionExtractionLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jchbRuleExtractionBaggedM5P)
                    .add(jlblPDFAToolForFlexibleRuleExtraction))
                .add(0, 0, Short.MAX_VALUE))
        );

        jpnlClassificationExtraction.setBorder(javax.swing.BorderFactory.createTitledBorder("Classification"));

        jchbRuleExtractFromRF.setText("Extract from Bagged J48");

        jlblPDFRuleExtractAcc.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grex/Graphics/pics/pdf.gif"))); // NOI18N
        jlblPDFRuleExtractAcc.setToolTipText("Automatically balancing accuracy and comprehensibility in predictive modeling");
        jlblPDFRuleExtractAcc.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jlblPDFRuleExtractAccMouseClicked(evt);
            }
        });

        jlblPDFRuleExtractBrier.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grex/Graphics/pics/pdf.gif"))); // NOI18N
        jlblPDFRuleExtractBrier.setToolTipText("Genetic rule extraction optimizing brier score");
        jlblPDFRuleExtractBrier.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jlblPDFRuleExtractBrierMouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jpnlClassificationExtractionLayout = new org.jdesktop.layout.GroupLayout(jpnlClassificationExtraction);
        jpnlClassificationExtraction.setLayout(jpnlClassificationExtractionLayout);
        jpnlClassificationExtractionLayout.setHorizontalGroup(
            jpnlClassificationExtractionLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlClassificationExtractionLayout.createSequentialGroup()
                .addContainerGap()
                .add(jchbRuleExtractFromRF)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jlblPDFRuleExtractAcc)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jlblPDFRuleExtractBrier)
                .addContainerGap(19, Short.MAX_VALUE))
        );
        jpnlClassificationExtractionLayout.setVerticalGroup(
            jpnlClassificationExtractionLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlClassificationExtractionLayout.createSequentialGroup()
                .add(jpnlClassificationExtractionLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jchbRuleExtractFromRF)
                    .add(jlblPDFRuleExtractAcc)
                    .add(jlblPDFRuleExtractBrier))
                .addContainerGap(699, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout jpnlSettingsExLayout = new org.jdesktop.layout.GroupLayout(jpnlSettingsEx);
        jpnlSettingsEx.setLayout(jpnlSettingsExLayout);
        jpnlSettingsExLayout.setHorizontalGroup(
            jpnlSettingsExLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlSettingsExLayout.createSequentialGroup()
                .addContainerGap()
                .add(jpnlSettingsExLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jpnlSettingsExLayout.createSequentialGroup()
                        .add(jchbOracleCoachingTest)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jlblPDFOracle)
                        .add(0, 0, Short.MAX_VALUE))
                    .add(jpnlSettingsExLayout.createSequentialGroup()
                        .add(jpnlClassificationExtraction, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jpnlRegressionExtraction, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 184, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jpnlSettingsExLayout.setVerticalGroup(
            jpnlSettingsExLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlSettingsExLayout.createSequentialGroup()
                .add(5, 5, 5)
                .add(jpnlSettingsExLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jchbOracleCoachingTest)
                    .add(jlblPDFOracle))
                .add(15, 15, 15)
                .add(jpnlSettingsExLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jpnlRegressionExtraction, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(jpnlClassificationExtraction, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        jTabbedPane1.addTab("Rule Extraction", jpnlSettingsEx);

        jpnlOther.setBorder(javax.swing.BorderFactory.createTitledBorder("Other"));

        jchbTreeInjection.setText("Use Tree Injection");

        jlblPDFSimplification1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grex/Graphics/pics/pdf.gif"))); // NOI18N
        jlblPDFSimplification1.setToolTipText("Improving GP classification performance by injection of decision trees");
        jlblPDFSimplification1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jlblPDFSimplification1MouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jpnlOtherLayout = new org.jdesktop.layout.GroupLayout(jpnlOther);
        jpnlOther.setLayout(jpnlOtherLayout);
        jpnlOtherLayout.setHorizontalGroup(
            jpnlOtherLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlOtherLayout.createSequentialGroup()
                .addContainerGap()
                .add(jchbTreeInjection)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jlblPDFSimplification1)
                .addContainerGap(283, Short.MAX_VALUE))
        );
        jpnlOtherLayout.setVerticalGroup(
            jpnlOtherLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlOtherLayout.createSequentialGroup()
                .addContainerGap()
                .add(jpnlOtherLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jlblPDFSimplification1)
                    .add(jchbTreeInjection))
                .addContainerGap(731, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Tree Injection", jpnlOther);

        jLabel34.setText("Min K");

        jftfMinKNN.setText("5");
        jftfMinKNN.setValue(new Integer(5));

        jLabel33.setText("Max K");

        jfmtMaxKnns.setText("17");
        jfmtMaxKnns.setValue(new Integer(17));

        jLabel16.setText("Weighted voting");

        jlblPDFGKnn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grex/Graphics/pics/pdf.gif"))); // NOI18N
        jlblPDFGKnn.setToolTipText("Evolving a Locally Optimized Instance Based Learner");
        jlblPDFGKnn.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jlblPDFGKnnMouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel34)
                    .add(jLabel33)
                    .add(jLabel16))
                .add(47, 47, 47)
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jchbWeightedVoting)
                    .add(jPanel3Layout.createSequentialGroup()
                        .add(jftfMinKNN, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 38, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jlblPDFGKnn))
                    .add(jfmtMaxKnns, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 37, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(230, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jlblPDFGKnn)
                    .add(jPanel3Layout.createSequentialGroup()
                        .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jftfMinKNN, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jLabel34))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jfmtMaxKnns, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jLabel33))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabel16)
                            .add(jchbWeightedVoting)))))
        );

        jTabbedPane1.addTab("Hybrid  kNN", jPanel3);

        jpnlAdvancedSettings.add(jTabbedPane1, java.awt.BorderLayout.PAGE_START);

        tabOptions.addTab("Advanced", jpnlAdvancedSettings);

        jpnlBenchmark.setLayout(new java.awt.BorderLayout());

        jpnlBenchClassification.setBorder(javax.swing.BorderFactory.createTitledBorder("Classification"));

        jchbJ48.setSelected(true);
        jchbJ48.setText("J48");

        jchbSimpleCart.setText("Simple Cart");

        jchbRepTree.setText("REPTree");

        jchbZeroR.setSelected(true);
        jchbZeroR.setText("ZeroR");

        jchbMLP.setText("MLP");
        jchbMLP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jchbMLPActionPerformed(evt);
            }
        });

        jchbSVM.setText("SVM");

        jchbRandomForest.setText("Random Forest");

        jchbBaggingJ48.setText("Bagging J48");

        org.jdesktop.layout.GroupLayout jpnlBenchClassificationLayout = new org.jdesktop.layout.GroupLayout(jpnlBenchClassification);
        jpnlBenchClassification.setLayout(jpnlBenchClassificationLayout);
        jpnlBenchClassificationLayout.setHorizontalGroup(
            jpnlBenchClassificationLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlBenchClassificationLayout.createSequentialGroup()
                .addContainerGap()
                .add(jpnlBenchClassificationLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jchbRepTree)
                    .add(jchbJ48)
                    .add(jchbZeroR)
                    .add(jchbSimpleCart)
                    .add(jchbSVM)
                    .add(jchbMLP)
                    .add(jchbRandomForest)
                    .add(jchbBaggingJ48))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jpnlBenchClassificationLayout.setVerticalGroup(
            jpnlBenchClassificationLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlBenchClassificationLayout.createSequentialGroup()
                .addContainerGap()
                .add(jchbZeroR)
                .add(3, 3, 3)
                .add(jchbJ48)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jchbSimpleCart)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jchbRepTree)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jchbMLP)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jchbSVM)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jchbRandomForest)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jchbBaggingJ48)
                .addContainerGap(583, Short.MAX_VALUE))
        );

        jpnlBenchmark.add(jpnlBenchClassification, java.awt.BorderLayout.LINE_START);

        jpnlBenchRegression.setBorder(javax.swing.BorderFactory.createTitledBorder("Regression"));

        jchbZeroRReg.setSelected(true);
        jchbZeroRReg.setText("ZeroR");

        jchbLinearRegression.setText("Linear Regression");

        jchbM5PRegTree.setSelected(true);
        jchbM5PRegTree.setText("M5P Regression Tree");

        jchbM5PModelTree.setText("M5P Smoothed Model Tree");

        jchbREPTreeReg.setText("REPTree");

        jchbPaceRegression.setText("Pace Regression");

        jchbMLPReg.setText("MLP");

        jchbSVMReg.setText("SVM");

        jchbRBF.setText("RBF");

        jchbBaggedM5P.setText("Bagged M5P");

        org.jdesktop.layout.GroupLayout jpnlBenchRegressionLayout = new org.jdesktop.layout.GroupLayout(jpnlBenchRegression);
        jpnlBenchRegression.setLayout(jpnlBenchRegressionLayout);
        jpnlBenchRegressionLayout.setHorizontalGroup(
            jpnlBenchRegressionLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlBenchRegressionLayout.createSequentialGroup()
                .addContainerGap()
                .add(jpnlBenchRegressionLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jchbZeroRReg)
                    .add(jchbLinearRegression)
                    .add(jchbM5PRegTree)
                    .add(jchbREPTreeReg)
                    .add(jchbPaceRegression)
                    .add(jchbM5PModelTree)
                    .add(jchbMLPReg)
                    .add(jchbSVMReg)
                    .add(jchbRBF)
                    .add(jchbBaggedM5P))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jpnlBenchRegressionLayout.setVerticalGroup(
            jpnlBenchRegressionLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlBenchRegressionLayout.createSequentialGroup()
                .addContainerGap()
                .add(jchbZeroRReg)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jchbLinearRegression)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jchbPaceRegression)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jchbREPTreeReg)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jchbM5PRegTree)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jchbM5PModelTree)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jchbMLPReg)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jchbRBF)
                .add(5, 5, 5)
                .add(jchbSVMReg)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jchbBaggedM5P)
                .addContainerGap(526, Short.MAX_VALUE))
        );

        jpnlBenchmark.add(jpnlBenchRegression, java.awt.BorderLayout.LINE_END);

        tabOptions.addTab("Benchmark", jpnlBenchmark);

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Classification"));

        jchbR_AUC.setSelected(true);
        jchbR_AUC.setText("AUC - Area under ROC curve");

        jchbR_BRI.setSelected(true);
        jchbR_BRI.setText("BRI - Brier score");

        jchbR_ACC.setSelected(true);
        jchbR_ACC.setText("ACC - Accuracy");

        jchbR_BRE.setText("BRE - Brevity");

        jLabel4.setText("Custom Classification Metrics");

        org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel4Layout.createSequentialGroup()
                .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jchbR_BRE)
                    .add(jchbR_BRI)
                    .add(jchbR_AUC)
                    .add(jchbR_ACC, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 153, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel4))
                .add(0, 16, Short.MAX_VALUE))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jtxfCustomClassifcation)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .add(jchbR_ACC)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jchbR_AUC, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jchbR_BRI)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jchbR_BRE)
                .add(40, 40, 40)
                .add(jLabel4)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jtxfCustomClassifcation, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(550, Short.MAX_VALUE))
        );

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Regression"));

        jchbR_MAE.setSelected(true);
        jchbR_MAE.setText("MAE - Mean Absolute Error");

        jchbR_RMSE.setSelected(true);
        jchbR_RMSE.setText("RMSE - Root Mean Square Error");

        jchbR_CORR.setSelected(true);
        jchbR_CORR.setText("R - Pearson correlation");

        jchbR_MAPE.setSelected(true);
        jchbR_MAPE.setText("MAPE - Mean Absolute Percentage E.");

        jchbR_MUAPE.setSelected(true);
        jchbR_MUAPE.setText("MUAPE - Mean Unbiased Absolute P. E.");

        jtxtfCustomRegression.setText("ErrorFunctions.ErrorInstances");
        jtxtfCustomRegression.setToolTipText("Metric class names, comma seperated");

        jLabel5.setText("Custom Regression Metrics");

        org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel5Layout.createSequentialGroup()
                        .add(0, 0, Short.MAX_VALUE)
                        .add(jchbR_MUAPE)
                        .addContainerGap())
                    .add(jPanel5Layout.createSequentialGroup()
                        .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jtxtfCustomRegression, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 205, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jchbR_MAPE)
                            .add(jchbR_CORR)
                            .add(jchbR_RMSE)
                            .add(jchbR_MAE)
                            .add(jLabel5))
                        .add(0, 0, Short.MAX_VALUE))))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .add(jchbR_MAE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jchbR_RMSE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jchbR_CORR)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jchbR_MAPE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jchbR_MUAPE)
                .add(14, 14, 14)
                .add(jLabel5)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jtxtfCustomRegression, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jchbR_Training.setSelected(true);
        jchbR_Training.setText("Trainingset results");

        jchbR_Length.setSelected(true);
        jchbR_Length.setText("Program length");

        org.jdesktop.layout.GroupLayout jpnlReportLayout = new org.jdesktop.layout.GroupLayout(jpnlReport);
        jpnlReport.setLayout(jpnlReportLayout);
        jpnlReportLayout.setHorizontalGroup(
            jpnlReportLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlReportLayout.createSequentialGroup()
                .addContainerGap()
                .add(jpnlReportLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jpnlReportLayout.createSequentialGroup()
                        .add(jPanel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 237, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jchbR_Length)
                    .add(jchbR_Training))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jpnlReportLayout.setVerticalGroup(
            jpnlReportLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jpnlReportLayout.createSequentialGroup()
                .addContainerGap()
                .add(jchbR_Training)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jchbR_Length)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jpnlReportLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        tabOptions.addTab("Report", jpnlReport);

        jpnlExperimenter.setLayout(new java.awt.BorderLayout());
        tabOptions.addTab("Experimenter", jpnlExperimenter);

        jbtnDecisionTree.setText("Create DT");
        jbtnDecisionTree.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnDecisionTreeActionPerformed(evt);
            }
        });

        jbtnRandomForest.setText("Create RF");
        jbtnRandomForest.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnRandomForestActionPerformed(evt);
            }
        });

        JftfDT_EntropyThreshold.setText("0.5"); // NOI18N
        JftfDT_EntropyThreshold.setToolTipText("Entropy Threshold"); // NOI18N
        JftfDT_EntropyThreshold.setValue(new Double(0.5));

        JftfDT_ScoreThreshold.setText("0.01"); // NOI18N
        JftfDT_ScoreThreshold.setToolTipText("Crossover probaillity."); // NOI18N
        JftfDT_ScoreThreshold.setValue(new Double(0.01));

        jLabel35.setText("Score Threshold");

        jLabel36.setText("Entropy Threshold");

        jftfForrest_Size.setText("500"); // NOI18N
        jftfForrest_Size.setToolTipText("Populatin size during simplification"); // NOI18N
        jftfForrest_Size.setValue(new Integer(500));

        jLabel38.setText("Forrest Size");

        jButton1.setText("MP5");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder("Test Settings"));

        jLabel39.setText("P1");

        JftfParameter1.setText("0"); // NOI18N
        JftfParameter1.setToolTipText("Crossover probaillity."); // NOI18N
        JftfParameter1.setValue(new Double(0.8));

        JftfParameter2.setText("0"); // NOI18N
        JftfParameter2.setToolTipText("Crossover probaillity."); // NOI18N
        JftfParameter2.setValue(new Double(0.8));

        JftfParameter3.setText("0"); // NOI18N
        JftfParameter3.setToolTipText("Crossover probaillity."); // NOI18N
        JftfParameter3.setValue(new Double(0.8));

        JftfParameter4.setText("0"); // NOI18N
        JftfParameter4.setToolTipText("Conformal e"); // NOI18N
        JftfParameter4.setValue(new Double(0.8));

        jLabel40.setText("P2");

        jLabel41.setText("P3");

        jLabel42.setText("P4");

        jftfTrainImportance.setText("1"); // NOI18N
        jftfTrainImportance.setToolTipText("Error cost for missclassfication of a validation instance."); // NOI18N
        jftfTrainImportance.setValue(new Double(1));

        jftfValImportance.setText("1"); // NOI18N
        jftfValImportance.setToolTipText("Error cost for missclassfication of a training instance."); // NOI18N
        jftfValImportance.setValue(new Double(1));

        jLabel10.setText("Train Importance"); // NOI18N

        jLabel11.setText("Val Importance"); // NOI18N

        org.jdesktop.layout.GroupLayout jPanel9Layout = new org.jdesktop.layout.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel9Layout.createSequentialGroup()
                .add(jPanel9Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel39)
                    .add(jLabel40)
                    .add(jLabel41)
                    .add(jLabel42)
                    .add(jLabel10)
                    .add(jLabel11))
                .add(43, 43, 43)
                .add(jPanel9Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(jftfTrainImportance)
                    .add(jftfValImportance)
                    .add(JftfParameter4)
                    .add(JftfParameter3)
                    .add(JftfParameter2)
                    .add(JftfParameter1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel9Layout.createSequentialGroup()
                .add(jPanel9Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(JftfParameter1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel39))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel9Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(JftfParameter2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel40))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel9Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(JftfParameter3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel41))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel9Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(JftfParameter4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel42))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel9Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel10)
                    .add(jftfValImportance, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel9Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jftfTrainImportance, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel11))
                .addContainerGap(35, Short.MAX_VALUE))
        );

        jbtnInjectionGP.setText("Injection GP");
        jbtnInjectionGP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnInjectionGPActionPerformed(evt);
            }
        });

        jbtnEvolveRandomforest.setText("Evolve RF");
        jbtnEvolveRandomforest.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnEvolveRandomforestActionPerformed(evt);
            }
        });

        jbtnSelectDirectory.setText("GP Time Series Exp. from folder");
        jbtnSelectDirectory.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnSelectDirectoryActionPerformed(evt);
            }
        });

        jLabel2.setText("Weighted attributes");

        jLabel31.setText("Attribute selection");

        jfmtConsideredNeigbhours.setText("17");
        jfmtConsideredNeigbhours.setValue(new Integer(50));

        jLabel15.setText("Cons. Neighbours");

        org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(jPanel2Layout.createSequentialGroup()
                            .add(jLabel2)
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                            .add(jchbWeightedAttributes))
                        .add(jPanel2Layout.createSequentialGroup()
                            .add(jLabel31)
                            .add(18, 18, 18)
                            .add(jchbAttributeSelection)))
                    .add(jPanel2Layout.createSequentialGroup()
                        .add(jLabel15)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jfmtConsideredNeigbhours, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 37, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(29, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .add(25, 25, 25)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jchbWeightedAttributes)
                    .add(jLabel2))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jLabel31)
                    .add(jchbAttributeSelection))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jfmtConsideredNeigbhours, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel15))
                .addContainerGap(38, Short.MAX_VALUE))
        );

        jtxfMail.setToolTipText("Send the results to one or several email addresses (seperate with ; )");

        jLabel29.setText("E-mail results");

        org.jdesktop.layout.GroupLayout jpnlTabTestLayout = new org.jdesktop.layout.GroupLayout(jpnlTabTest);
        jpnlTabTest.setLayout(jpnlTabTestLayout);
        jpnlTabTestLayout.setHorizontalGroup(
            jpnlTabTestLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlTabTestLayout.createSequentialGroup()
                .addContainerGap()
                .add(jpnlTabTestLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel35)
                    .add(jLabel36))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jpnlTabTestLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(JftfDT_EntropyThreshold)
                    .add(JftfDT_ScoreThreshold, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 35, Short.MAX_VALUE))
                .add(30, 30, 30)
                .add(jLabel38)
                .add(18, 18, 18)
                .add(jftfForrest_Size, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 6, Short.MAX_VALUE)
                .add(1164, 1164, 1164))
            .add(jpnlTabTestLayout.createSequentialGroup()
                .add(jpnlTabTestLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jpnlTabTestLayout.createSequentialGroup()
                        .add(17, 17, 17)
                        .add(jpnlTabTestLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jButton1)
                            .add(jpnlTabTestLayout.createSequentialGroup()
                                .add(jbtnDecisionTree)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(jbtnRandomForest)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(jbtnEvolveRandomforest, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 117, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                .add(jbtnInjectionGP))))
                    .add(jpnlTabTestLayout.createSequentialGroup()
                        .add(jpnlTabTestLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jpnlTabTestLayout.createSequentialGroup()
                                .add(jLabel29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 73, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(162, 162, 162))
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, jpnlTabTestLayout.createSequentialGroup()
                                .add(jPanel9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)))
                        .add(jpnlTabTestLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jbtnSelectDirectory)))
                    .add(jtxfMail, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 310, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jpnlTabTestLayout.setVerticalGroup(
            jpnlTabTestLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlTabTestLayout.createSequentialGroup()
                .addContainerGap()
                .add(jpnlTabTestLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel35)
                    .add(JftfDT_ScoreThreshold, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jftfForrest_Size, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel38))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jpnlTabTestLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(JftfDT_EntropyThreshold, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel36))
                .add(21, 21, 21)
                .add(jpnlTabTestLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jbtnInjectionGP)
                    .add(jbtnEvolveRandomforest)
                    .add(jbtnRandomForest)
                    .add(jbtnDecisionTree))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jButton1)
                .add(jpnlTabTestLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(jpnlTabTestLayout.createSequentialGroup()
                        .add(8, 8, 8)
                        .add(jbtnSelectDirectory)
                        .add(137, 137, 137)
                        .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jpnlTabTestLayout.createSequentialGroup()
                        .add(18, 18, 18)
                        .add(jPanel9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .add(jLabel29)))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jtxfMail, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(348, Short.MAX_VALUE))
        );

        tabOptions.addTab("Test", jpnlTabTest);

        txaErrorLog.setColumns(20);
        txaErrorLog.setRows(5);
        jScrollPane1.setViewportView(txaErrorLog);

        org.jdesktop.layout.GroupLayout jpnlTabErrorLayout = new org.jdesktop.layout.GroupLayout(jpnlTabError);
        jpnlTabError.setLayout(jpnlTabErrorLayout);
        jpnlTabErrorLayout.setHorizontalGroup(
            jpnlTabErrorLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 435, Short.MAX_VALUE)
        );
        jpnlTabErrorLayout.setVerticalGroup(
            jpnlTabErrorLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 815, Short.MAX_VALUE)
        );

        tabOptions.addTab("Error log", jpnlTabError);

        jbtnLoadFile.setText("Select Data"); // NOI18N
        jbtnLoadFile.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLoadFileHandler(evt);
            }
        });

        jbtnLoadBNF.setText("Select BNF"); // NOI18N
        jbtnLoadBNF.setPreferredSize(new java.awt.Dimension(97, 25));
        jbtnLoadBNF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLoadBNFHnadler(evt);
            }
        });

        jcmbBNF.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Only continuous attributes", "Only categorical attributes", "Continuous and categorical attributes", "AND conditions. Only continuous attributes", "AND conditions. Only categorical attributes", "AND conditions. Continuous and categorical attributes", "Simple regression continuous and categorial attributes" }));
        jcmbBNF.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jcmbBNFItemStateChanged(evt);
            }
        });
        jcmbBNF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcmbBNFActionPerformed(evt);
            }
        });

        jcmbDataFile.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "breast-cancer", "breast-w", "cmc", "colic", "credit-a", "credit-g", "cylinder-bands", "diabetes", "ecoli", "glass", "haberman", "heart-cleveland", "heart-statlog", "hepatitis", "ionosphere", "iris", "labor", "liver-disorders", "lymph", "sick", "sonar", "vote", "vehicle", "tae", "tic-tac-toe", "wine", "zoo", "32_201112", "50_141521", "50_201258", "50_202963", "50_212463", "50_214368", "reg-auto_price", "reg-housing", "reg-machine_cpu", "reg-pharynx", "reg-sensory", "reg-servo", "reg-sleep", "reg-veteran", "reg-wisconsin" }));
        jcmbDataFile.setMaximumSize(new java.awt.Dimension(107, 20));
        jcmbDataFile.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcmbDataFileActionPerformed(evt);
            }
        });

        jbtnSetupFile.setText("Setup File"); // NOI18N
        jbtnSetupFile.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnSetupFileActionPerformed(evt);
            }
        });

        jbtnEditBnf.setText("Edit BNF"); // NOI18N
        jbtnEditBnf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnEditBnfActionPerformed(evt);
            }
        });

        jcmbFold.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ALL", "F1", "F2", "F3", "F4" }));

        jcmbValFold.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jcmbValFold.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcmbValFoldActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(jbtnLoadFile, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jbtnLoadBNF, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jcmbValFold, 0, 1, Short.MAX_VALUE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jcmbFold, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 97, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jbtnSetupFile, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 90, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(18, 18, 18)
                        .add(jbtnEditBnf, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE))
                    .add(jcmbBNF, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(jcmbDataFile, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(10, 10, 10)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jbtnLoadFile)
                    .add(jcmbDataFile, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(5, 5, 5)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jbtnLoadBNF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jcmbBNF, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jbtnSetupFile)
                    .add(jbtnEditBnf)
                    .add(jcmbFold, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jcmbValFold, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
        );

        jcbUseMarkerColumn.setSelected(true);
        jcbUseMarkerColumn.setText("Use marker column if present"); // NOI18N

        jbtnAdvancedCreate.setText("Start"); // NOI18N
        jbtnAdvancedCreate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnAdvancedCreateActionPerformed(evt);
            }
        });

        jchbEXPUseValidationFold.setText("Use validation fold");

        jlblPDFGPFrameWork.setIcon(new javax.swing.ImageIcon(getClass().getResource("/grex/Graphics/pics/pdf.gif"))); // NOI18N
        jlblPDFGPFrameWork.setToolTipText("G-REX A Versatile Framework for Evolutionary Data Mining");
        jlblPDFGPFrameWork.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jlblPDFGPFrameWorkMouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout tabFileLayout = new org.jdesktop.layout.GroupLayout(tabFile);
        tabFile.setLayout(tabFileLayout);
        tabFileLayout.setHorizontalGroup(
            tabFileLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(tabFileLayout.createSequentialGroup()
                .add(tabFileLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(tabFileLayout.createSequentialGroup()
                        .addContainerGap()
                        .add(jcbUseMarkerColumn)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jchbEXPUseValidationFold)
                        .add(28, 28, 28)
                        .add(jlblPDFGPFrameWork)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jbtnAdvancedCreate, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .add(tabFileLayout.createSequentialGroup()
                        .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(0, 0, Short.MAX_VALUE)))
                .add(0, 0, 0))
        );
        tabFileLayout.setVerticalGroup(
            tabFileLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(tabFileLayout.createSequentialGroup()
                .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(tabFileLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(tabFileLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jcbUseMarkerColumn)
                        .add(jchbEXPUseValidationFold))
                    .add(jlblPDFGPFrameWork)
                    .add(jbtnAdvancedCreate))
                .add(0, 16, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout jpnlSettingsLayout = new org.jdesktop.layout.GroupLayout(jpnlSettings);
        jpnlSettings.setLayout(jpnlSettingsLayout);
        jpnlSettingsLayout.setHorizontalGroup(
            jpnlSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(tabOptions, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
            .add(tabFile, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jpnlSettingsLayout.setVerticalGroup(
            jpnlSettingsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jpnlSettingsLayout.createSequentialGroup()
                .add(tabFile, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(tabOptions, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 843, Short.MAX_VALUE))
        );

        tabOptions.getAccessibleContext().setAccessibleName("G-REX");

        getContentPane().add(jpnlSettings, java.awt.BorderLayout.WEST);

        getAccessibleContext().setAccessibleName("-REX 10.0");

        setSize(new java.awt.Dimension(1655, 1025));
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents


    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        saveGuiState();
      //  evolutionaryProces.getThread().interrupt();
        System.exit(0);
            
    }//GEN-LAST:event_formWindowClosing

    private void tabOptionsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_tabOptionsStateChanged
        if (tabOptions.getSelectedIndex() == 2) {
        }
    }//GEN-LAST:event_tabOptionsStateChanged

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

   }//GEN-LAST:event_jButton1ActionPerformed

    private void jbtnRandomForestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnRandomForestActionPerformed

    }//GEN-LAST:event_jbtnRandomForestActionPerformed

    private void jbtnDecisionTreeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnDecisionTreeActionPerformed

    }//GEN-LAST:event_jbtnDecisionTreeActionPerformed

    private void jbtnAdvancedCreateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnAdvancedCreateActionPerformed
        Options o = getAdvancedOptions();

        startNewGREX(o, currentData.clone(), false);
    }//GEN-LAST:event_jbtnAdvancedCreateActionPerformed

    private void jbtnInjectionGPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnInjectionGPActionPerformed

    }//GEN-LAST:event_jbtnInjectionGPActionPerformed

    private void jbtnEvolveRandomforestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnEvolveRandomforestActionPerformed

    }//GEN-LAST:event_jbtnEvolveRandomforestActionPerformed

    private void jcmbValFoldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcmbValFoldActionPerformed
        if (jcmbValFold.getItemCount() > 0) {
            String oldValue = jcmbFold.getSelectedItem().toString();
            jcmbFold.removeAllItems();
            for (String s : currentData.getFoldNames()) {
                jcmbFold.addItem(s);
            }
            jcmbFold.addItem("ALL");

            jcmbFold.setSelectedItem(oldValue);
            jcmbFold.removeItem(jcmbValFold.getSelectedItem().toString());
            jcmbFold.addItem("NONE");
            currentData.setValFold(jcmbValFold.getSelectedItem().toString());
        }
    }//GEN-LAST:event_jcmbValFoldActionPerformed

    private void jftfSimpGenerationsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jftfSimpGenerationsActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jftfSimpGenerationsActionPerformed

    private void jftfPersistenceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jftfPersistenceActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jftfPersistenceActionPerformed

    private void jftfMaxTreeSizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jftfMaxTreeSizeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jftfMaxTreeSizeActionPerformed

    private void jbtnSelectDirectoryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnSelectDirectoryActionPerformed

    }//GEN-LAST:event_jbtnSelectDirectoryActionPerformed

    private void jbtnEditBnfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnEditBnfActionPerformed
        try {
            BNFEditor be = new BNFEditor(this, (String) jcmbBNF.getSelectedItem());            
            jdtpMain.add(be);
            be.setMaximum(true);
            setEnabled(false);
        } catch (Exception ex) {
            ErrorManager.getInstance().reportError(ex);
        }
    }//GEN-LAST:event_jbtnEditBnfActionPerformed

    private void jbtnSetupFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnSetupFileActionPerformed
        dataFrame = new DataFrame(currentData, nrOfFolds,this);
        jdtpMain.add(dataFrame);
        try {
            dataFrame.setMaximum(true);
            setEnabled(false);
            // dataFrame.setModel(currentData);
        } catch (PropertyVetoException ex) {
            ErrorManager.getInstance().reportError(ex);
        }

        dataFrame.setVisible(true);
        this.currentData = dataFrame.getModel();
        nrOfFolds = currentData.getNrOfFolds();

        //  this.currentData.setNrOfFolds(dataFrame.getNrOfFolds());
        initComboBoxes();
    }//GEN-LAST:event_jbtnSetupFileActionPerformed

    private void jcmbDataFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcmbDataFileActionPerformed

        loadFile();
    }//GEN-LAST:event_jcmbDataFileActionPerformed

    private void btnLoadBNFHnadler(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoadBNFHnadler
        String directory = "";
        if (jfcData != null) {
            directory = jfcData.getDirectory();

        }
        jfcBNF = new FileDialog(this, "Select BNF", FileDialog.LOAD);
        jfcBNF.setDirectory(directory);
        jfcBNF.setVisible(true);
        String bnf = jfcBNF.getDirectory() + jfcBNF.getFile();
        if (!bnf.equalsIgnoreCase("nullnull")) {
            jcmbBNF.addItem(bnf);
            jcmbBNF.setSelectedItem(bnf);
        }
        //jlblBNF.setText(jfcBNF.getDirectory()+jfcBNF.getFile());//
    }//GEN-LAST:event_btnLoadBNFHnadler

    private void btnLoadFileHandler(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoadFileHandler
        String directory = "";
        if (jfcBNF != null) {
            directory = jfcBNF.getDirectory();

        }

        if (jfcBNF != null) {
            directory = jfcBNF.getDirectory();

        }
        jfcData = new FileDialog(this, "Select data file", FileDialog.LOAD);
        jfcData.setDirectory(directory);
        jfcData.setVisible(true);
        String s = jfcData.getDirectory() + jfcData.getFile();
        if (!s.equalsIgnoreCase("nullnull")) {
            jcmbDataFile.addItem(s);
            jcmbDataFile.setSelectedItem(s);
        }
    }//GEN-LAST:event_btnLoadFileHandler

    private void jsldCompStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jsldCompStateChanged
        setAutoSetting();
    }//GEN-LAST:event_jsldCompStateChanged

    private void jsldSearchStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jsldSearchStateChanged
        setAutoSetting();
    }//GEN-LAST:event_jsldSearchStateChanged

    private void jchbMLPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jchbMLPActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jchbMLPActionPerformed

    private void jcmbBNFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcmbBNFActionPerformed
      /*  Object item = jcmbBNF.getSelectedItem();
        if(item!=null&&((String)item).startsWith("Fuzzy")&&currentData!=null)
            currentData.fuzzit(3);//*/
    }//GEN-LAST:event_jcmbBNFActionPerformed

    private void jcmbBNFItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jcmbBNFItemStateChanged
         Object item = jcmbBNF.getSelectedItem();
        if(item!=null)//&&((String)item).startsWith("Fuzzy")&&currentData!=null)
            loadFile();
    }//GEN-LAST:event_jcmbBNFItemStateChanged

    private void jchbSimplifyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jchbSimplifyActionPerformed
        SimplificationStateChanged();
    }//GEN-LAST:event_jchbSimplifyActionPerformed

    private void jchbSimplifyItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jchbSimplifyItemStateChanged
        SimplificationStateChanged();
    }//GEN-LAST:event_jchbSimplifyItemStateChanged

    private void jlblPDFSimplificationMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jlblPDFSimplificationMouseClicked
        showPDF("König, Johansson, Niklasson - 2006 - Increasing rule extraction comprehensibility.pdf");
    }//GEN-LAST:event_jlblPDFSimplificationMouseClicked

    private void jlblPDFSimplification1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jlblPDFSimplification1MouseClicked
        showPDF("König et al. - 2010 - Improving GP classification performance by injection of decision trees.pdf");
    }//GEN-LAST:event_jlblPDFSimplification1MouseClicked

    private void jlblPDFOracleMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jlblPDFOracleMouseClicked
        showPDF("Johansson et al. - 2006 - Why Not Use an Oracle When You Got One.pdf");
    }//GEN-LAST:event_jlblPDFOracleMouseClicked

    private void jlblPDFRuleExtractAccMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jlblPDFRuleExtractAccMouseClicked
            showPDF("Johansson, König, Niklasson - 2005 - Automatically balancing accuracy and comprehensibility in predictive modeling.pdf");
    }//GEN-LAST:event_jlblPDFRuleExtractAccMouseClicked

    private void jlblPDFRuleExtractBrierMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jlblPDFRuleExtractBrierMouseClicked
        showPDF("Johansson, König, Niklasson - 2010 - Genetic rule extraction optimizing brier score.pdf");
    }//GEN-LAST:event_jlblPDFRuleExtractBrierMouseClicked

    private void jlblPDFAToolForFlexibleRuleExtractionMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jlblPDFAToolForFlexibleRuleExtractionMouseClicked
        showPDF("König, Johansson, Niklasson - 2007 - Genetic programming - a tool for flexible rule extraction.pdf");
    }//GEN-LAST:event_jlblPDFAToolForFlexibleRuleExtractionMouseClicked

    private void jlblPDFRuleQualityMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jlblPDFRuleQualityMouseClicked
        showPDF("König, Johansson, Niklasson - 2008 - Using Genetic Programming to Increase Rule Quality.pdf");
    }//GEN-LAST:event_jlblPDFRuleQualityMouseClicked

    private void jlblPDFGPFrameWorkMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jlblPDFGPFrameWorkMouseClicked
        showPDF("König, Johansson, Niklasson - 2008 - G-REX A Versatile Framework for Evolutionary Data Mining.pdf");
    }//GEN-LAST:event_jlblPDFGPFrameWorkMouseClicked

    private void jlblPDFRegOptimizationMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jlblPDFRegOptimizationMouseClicked
        showPDF("König, Johansson, Niklasson - 2012 - Optimization and Evaluation Criteria in GP Regression.pdf");
    }//GEN-LAST:event_jlblPDFRegOptimizationMouseClicked

    private void jlblPDFGKnnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jlblPDFGKnnMouseClicked
        showPDF("Johansson, König, Niklasson - 2008 - Evolving a Locally Optimized Instance Based Learner.pdf");
    }//GEN-LAST:event_jlblPDFGKnnMouseClicked
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new GREXGUI().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JFormattedTextField JftfCrossover;
    private javax.swing.JFormattedTextField JftfDT_EntropyThreshold;
    private javax.swing.JFormattedTextField JftfDT_ScoreThreshold;
    private javax.swing.JFormattedTextField JftfParameter1;
    private javax.swing.JFormattedTextField JftfParameter2;
    private javax.swing.JFormattedTextField JftfParameter3;
    private javax.swing.JFormattedTextField JftfParameter4;
    private javax.swing.JButton jButton1;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JCheckBox jCheckBox2;
    private javax.swing.JFormattedTextField jFormattedTextField1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel41;
    private javax.swing.JLabel jLabel42;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JButton jbtnAdvancedCreate;
    private javax.swing.JButton jbtnDecisionTree;
    private javax.swing.JButton jbtnEditBnf;
    private javax.swing.JButton jbtnEvolveRandomforest;
    private javax.swing.JButton jbtnInjectionGP;
    private javax.swing.JButton jbtnLoadBNF;
    private javax.swing.JButton jbtnLoadFile;
    private javax.swing.JButton jbtnRandomForest;
    private javax.swing.JButton jbtnSelectDirectory;
    private javax.swing.JButton jbtnSetupFile;
    private javax.swing.JCheckBox jcbUseMarkerColumn;
    private javax.swing.JCheckBox jchbAttributeSelection;
    private javax.swing.JCheckBox jchbBaggedM5P;
    private javax.swing.JCheckBox jchbBaggingJ48;
    private javax.swing.JCheckBox jchbEXPUseValidationFold;
    private javax.swing.JCheckBox jchbElitism;
    private javax.swing.JCheckBox jchbFastSimplification;
    private javax.swing.JCheckBox jchbJ48;
    private javax.swing.JCheckBox jchbLaplace;
    private javax.swing.JCheckBox jchbLinearRegression;
    private javax.swing.JCheckBox jchbM5PModelTree;
    private javax.swing.JCheckBox jchbM5PRegTree;
    private javax.swing.JCheckBox jchbMLP;
    private javax.swing.JCheckBox jchbMLPReg;
    private javax.swing.JCheckBox jchbOracleCoachingTest;
    private javax.swing.JCheckBox jchbPaceRegression;
    private javax.swing.JCheckBox jchbRBF;
    private javax.swing.JCheckBox jchbREPTreeReg;
    private javax.swing.JCheckBox jchbR_ACC;
    private javax.swing.JCheckBox jchbR_AUC;
    private javax.swing.JCheckBox jchbR_BRE;
    private javax.swing.JCheckBox jchbR_BRI;
    private javax.swing.JCheckBox jchbR_CORR;
    private javax.swing.JCheckBox jchbR_Length;
    private javax.swing.JCheckBox jchbR_MAE;
    private javax.swing.JCheckBox jchbR_MAPE;
    private javax.swing.JCheckBox jchbR_MUAPE;
    private javax.swing.JCheckBox jchbR_RMSE;
    private javax.swing.JCheckBox jchbR_Training;
    private javax.swing.JCheckBox jchbRandomForest;
    private javax.swing.JCheckBox jchbRepTree;
    private javax.swing.JCheckBox jchbRuleExtractFromRF;
    private javax.swing.JCheckBox jchbRuleExtractionBaggedM5P;
    private javax.swing.JCheckBox jchbSVM;
    private javax.swing.JCheckBox jchbSVMReg;
    private javax.swing.JCheckBox jchbSave;
    private javax.swing.JCheckBox jchbSimpleCart;
    private javax.swing.JCheckBox jchbSimplify;
    private javax.swing.JCheckBox jchbTreeInjection;
    private javax.swing.JCheckBox jchbWeightedAttributes;
    private javax.swing.JCheckBox jchbWeightedVoting;
    private javax.swing.JCheckBox jchbZeroR;
    private javax.swing.JCheckBox jchbZeroRReg;
    private javax.swing.JComboBox jcmbBNF;
    private javax.swing.JComboBox jcmbCreationType;
    private javax.swing.JComboBox jcmbDataFile;
    private javax.swing.JComboBox jcmbFitnessFunction;
    private javax.swing.JComboBox jcmbFold;
    private javax.swing.JComboBox jcmbValFold;
    private javax.swing.JDesktopPane jdtpMain;
    private javax.swing.JFormattedTextField jfmtConsideredNeigbhours;
    private javax.swing.JFormattedTextField jfmtMaxKnns;
    private javax.swing.JFormattedTextField jftfBatchSize;
    private javax.swing.JFormattedTextField jftfCreationDepth;
    private javax.swing.JFormattedTextField jftfForrest_Size;
    private javax.swing.JFormattedTextField jftfGenerations;
    private javax.swing.JFormattedTextField jftfLengthPunishment;
    private javax.swing.JFormattedTextField jftfMaxTreeSize;
    private javax.swing.JFormattedTextField jftfMinKNN;
    private javax.swing.JFormattedTextField jftfMutation;
    private javax.swing.JFormattedTextField jftfPersistence;
    private javax.swing.JFormattedTextField jftfPopulation;
    private javax.swing.JFormattedTextField jftfSimpBatchSize;
    private javax.swing.JFormattedTextField jftfSimpGenerations;
    private javax.swing.JFormattedTextField jftfSimpPopulation;
    private javax.swing.JFormattedTextField jftfTournamentMembers;
    private javax.swing.JFormattedTextField jftfTrainImportance;
    private javax.swing.JFormattedTextField jftfValImportance;
    private javax.swing.JLabel jlbSimpGenerations;
    private javax.swing.JLabel jlblA1;
    private javax.swing.JLabel jlblA2;
    private javax.swing.JLabel jlblA3;
    private javax.swing.JLabel jlblA4;
    private javax.swing.JLabel jlblE1;
    private javax.swing.JLabel jlblE2;
    private javax.swing.JLabel jlblPDFAToolForFlexibleRuleExtraction;
    private javax.swing.JLabel jlblPDFGKnn;
    private javax.swing.JLabel jlblPDFGPFrameWork;
    private javax.swing.JLabel jlblPDFOracle;
    private javax.swing.JLabel jlblPDFRegOptimization;
    private javax.swing.JLabel jlblPDFRuleExtractAcc;
    private javax.swing.JLabel jlblPDFRuleExtractBrier;
    private javax.swing.JLabel jlblPDFRuleQuality;
    private javax.swing.JLabel jlblPDFSimplification;
    private javax.swing.JLabel jlblPDFSimplification1;
    private javax.swing.JLabel jlblSimpBatch;
    private javax.swing.JLabel jlblSimpPopulation;
    private javax.swing.JPanel jpnlAdvancedSettings;
    private javax.swing.JPanel jpnlAutoMode;
    private javax.swing.JPanel jpnlBenchClassification;
    private javax.swing.JPanel jpnlBenchRegression;
    private javax.swing.JPanel jpnlBenchmark;
    private javax.swing.JPanel jpnlClassificationExtraction;
    private javax.swing.JPanel jpnlExperimenter;
    private javax.swing.JPanel jpnlGPSettings;
    private javax.swing.JPanel jpnlOther;
    private javax.swing.JPanel jpnlRegressionExtraction;
    private javax.swing.JPanel jpnlReport;
    private javax.swing.JPanel jpnlRunSettings;
    private javax.swing.JPanel jpnlSettings;
    private javax.swing.JPanel jpnlSettingsEx;
    private javax.swing.JPanel jpnlSimplification;
    private javax.swing.JPanel jpnlTabError;
    private javax.swing.JPanel jpnlTabTest;
    private javax.swing.JSlider jsldComp;
    private javax.swing.JSlider jsldSearch;
    private javax.swing.JTextField jtxfCustomClassifcation;
    private javax.swing.JTextField jtxfMail;
    private javax.swing.JTextField jtxtfCustomRegression;
    private javax.swing.JLabel lblE10;
    private javax.swing.JLabel lblE11;
    private javax.swing.JLabel lblE12;
    private javax.swing.JLabel lblE13;
    private javax.swing.JLabel lblE14;
    private javax.swing.JLabel lblE15;
    private javax.swing.JLabel lblE3;
    private javax.swing.JLabel lblE4;
    private javax.swing.JLabel lblE5;
    private javax.swing.JLabel lblE6;
    private javax.swing.JLabel lblE7;
    private javax.swing.JLabel lblE8;
    private javax.swing.JLabel lblE9;
    private javax.swing.JPanel tabAuto;
    private javax.swing.JPanel tabExpert;
    private javax.swing.JPanel tabFile;
    private javax.swing.JTabbedPane tabOptions;
    private javax.swing.JTextArea txaErrorLog;
    // End of variables declaration//GEN-END:variables

class MyDesktopPane extends JDesktopPane{
  Image img;
  public MyDesktopPane(Image img)
  {
    try
    {
        this.img = img;
      //img = javax.imageio.ImageIO.read(new java.net.URL(getClass().getResource("/grex/Graphics/pics/g-rex.jpg"), "/grex/Graphics/pics/g-rex.jpg"));
        //img = new javax.swing.ImageIcon(getClass().getResource("/grex/Graphics/pics/g-rex.jpg")).getImage();
    }
    catch(Exception e){}//do nothing
  }
  public void paintComponent(Graphics g)
  {
    super.paintComponent(g);
    if(img != null) g.drawImage(img, 0,0,this.getWidth(),this.getHeight(),this);
    else{
        g.setColor(Color.red);
        g.drawString("Image not found", 50,50);
    
    }
  }
}

    
}
